Repository navigation
Conversation
ctawiah
added this pull request to stack #955
October 22, 2026 22:19
cursor
Bot
force-pushed
the
ctawiah/keep-unused-attachments-1e8a
branch
from
October 23, 2026 00:13
89a0169 to
9b6a6ed
Compare
ctawiah
removed this pull request from stack #955
October 23, 2026 00:15
ctawiah
added this pull request to stack #960
October 23, 2026 00:16
This was referenced Oct 23, 2026
ctawiah
marked this pull request as ready for review
October 23, 2026 14:09
ctawiah
requested review from
nieblara and
nkester-ld
and removed request for
a team
October 23, 2026 14:09
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9b6a6ed. Configure here.
cursor
Bot
force-pushed
the
ctawiah/keep-unused-attachments-1e8a
branch
2 times, most recently
from
October 23, 2026 14:40
c607801 to
f89bdfc
Compare
Sync no longer deletes tool and skill files that no variation uses, and it keeps their sync.lock and remote manifest entries. A detach of a variation also keeps its tools and skills. They sync on their own. Detach now takes resources of every kind. It refuses a tool or a skill that a local variation still uses. It lists every resource, marks the resources with local changes, and asks once. --yes skips the question, also with --archive. Without a terminal, detach needs --yes. Attach keeps the local content of a tool or skill file that no variation uses yet.
A detach with --archive tried to archive each selected resource as a variation. A tool or skill in the selection failed after the question, and variations before it were already archived while the local detach never ran. The archive now skips tools and skills, because LaunchDarkly keeps them. Detach deleted the variation files and the tool and skill files in two transactions. When the second one failed, the variation files were gone while the baseline came back, so local edits were lost. Store now has DeleteResources, which deletes the files of every kind in one transaction, and it replaces DeleteAttachments.
cursor
Bot
force-pushed
the
ctawiah/keep-unused-attachments-1e8a
branch
from
October 23, 2026 14:44
f89bdfc to
bd1b7d8
Compare
nkester-ld
reviewed
Oct 23, 2026
|
|
||
| // Detach deletes the variation, tool, and skill files in one transaction. When | ||
| // one file cannot be deleted, every file stays, and so does the baseline. | ||
| func TestRunKeepsEveryFileWhenOneDeleteFails(t *testing.T) { |
There was a problem hiding this comment.
I like the all or nothing behavior.
nkester-ld
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Context
ldcli sync promptskeeps the files of prompt variations in step with LaunchDarkly. A variation can use tools and skills, and their files live next to the variation files. Phase 1 treats a tool or skill file as a part of the variations that use it:sync promptslists each tool and skill file that no variation uses. It deletes the file with--yes, or after the user answers yes.sync.lockand manifest rows of unused tools and skills.sync prompts detachdrops the rows of the tools and skills that only the detached variations used.detachasks for confirmation only with--archive.The rest of this stack syncs a tool or skill on its own, also when no variation uses it. #941 already keeps the rows of unused tools and skills. So the deletion above now removes a file that sync still tracks, and the next sync of tools restores it.
What changes
cleanupOrphanedAttachments,OrphanedAttachments, andRemoveUnusedAttachmentsare removed.detachworks for every resource kind.sync prompts detachstill lists only variations. Later PRs in this stack addsync tools detachandsync skills detach.tool demo/search is used by variation demo/support/default. Remove it from that variation first.If the same detach also removes that variation, the tool is free.sync prompts detachkeeps the tools and skills of the variation, with their files and rows. They keep syncing on their own.sync.lockrow.--yesskips the question, and also covers--archive. Without a terminal and without--yes, detach fails with the confirmation error.--archivearchives only variations. LaunchDarkly keeps a detached tool or skill.attachof a tool that already has a file keeps the local content, as it already does for a tool that another variation uses.A detach in a terminal after a local edit:
Design notes
detach.Options.Kindis the kind that the picker lists.loadResourcesreturns every kind, so a selection by flags works for any kind.attachnow reads a tool file throughCompileAttachments. So one read covers a tool that a variation uses and a tool that no variation uses.Store.DeleteResourcesdeletes the files of every kind in one transaction, and replacesDeleteAttachments. The delete row of a sync uses it too.sync prompts detach <selector> --no-inputmust now add--yes.sync promptsstill offers to delete their files. This PR removes that offer.Review focus
sync prompts detachacceptable for Phase 1 scripts?Verification
go test ./...andgolangci-lint run(v2.9.0) pass.TestPromptDeletesUnreferencedLocalToolWithYesbecomesTestPromptKeepsUnreferencedLocalToolWithYes. The file, the lock row, and the manifest row stay.TestPromptDetachKeepsToolsOfTheVariationchecks thatsync prompts detach --yeskeeps the tool file and its rows.--archive, the mark, and the error without a terminal.TestRunKeepsEveryFileWhenOneDeleteFailsuses a tool file that cannot be deleted, and checks that the variation file and the baseline stay. It fails withoutc6078016.TestRunArchiveWithAToolArchivesOnlyTheVariationarchives the variation, detaches both resources, and makes no archive request for the tool. It fails withoutc6078016.ldcliand ran these flows against a stand-in for the LaunchDarkly API:sync prompts --yeskeeps a standalone tool file.--yesand without a terminal fails.detach --yes --no-inputkeeps the tool files.Related changes
This stack builds on #937 to #941, which are merged.
ctawiah/fix-prompt-tool-diff-5b1c)ctawiah/plan-referenced-attachments-1e8a)ctawiah/keep-unused-attachments-1e8a)ctawiah/add-attachments-1e8a)ctawiah/route-scopes-1e8a)ctawiah/scope-commands-1e8a)ctawiah/create-attachments-1e8a)ctawiah/create-attachment-flags-1e8a)ctawiah/share-variation-selection-1e8a)ctawiah/create-variations-1e8a)ctawiah/create-variation-flags-1e8a)Note
Overview
Tools and skills are first-class sync resources: sync no longer offers to delete unreferenced tool/skill files or prune their
sync.lockrows, and detach can stop syncing variations, tools, or skills (prompt detach still targets variations only viaKind).Detach now lists selected resources, warns when local files differ from the lock, and asks once before deleting (with optional
--archivefor variations only).--yesis required for non-interactive runs, including scripts that useddetach … --no-inputwithout--yes. Detaching a variation leaves its tools/skills on disk and in the lock; detaching a tool/skill is blocked while a local variation still references it unless that variation is detached in the same command. File removal uses transactionalDeleteResources, and manifest updates only remove explicitly selected IDs.Attach preserves local edits for tools that already have a standalone file, not only when another variation references them.
Reviewed by Cursor Bugbot for commit c607801. Bugbot is set up for automated code reviews on this repo. Configure here.