fix(3678): executor must respect commit_docs:false; teach SDK skip envelope#3679
fix(3678): executor must respect commit_docs:false; teach SDK skip envelope#3679trek-e wants to merge 4 commits into
Conversation
…velope Closes #3678 When `commit_docs: false` in `.planning/config.json`, the SDK's `cmdCommit` correctly short-circuits and returns `{committed: false, hash: null, reason: 'skipped_commit_docs_false'}` without staging or committing anything. The agent prompt at `agents/gsd-executor.md:710-720` (final_commit block) tells the executor to call `gsd-sdk query commit "docs(...)" --files .planning/...` but says NOTHING about how to interpret a skipped return. With no explicit instruction, the LLM improvises raw `git add` / `git add -f` / `git commit` to "fulfill" the per-plan commit step it was told to make, which leaks gitignored `.planning/` artifacts into the user's git history (exactly what the reporter observed). Three coordinated fixes: 1. **agents/gsd-executor.md final_commit block** — adds explicit handling text for all three SDK return envelopes (`committed:true`, `skipped:true commit_docs`, `skipped:true gitignored`, `committed:false other reasons`). States plainly: "Do not fall back to raw `git add` / `git commit` / `git add -f` when the SDK returns `skipped: true`." 2. **get-shit-done/bin/lib/commands.cjs cmdCommit** — adds `skipped: true` to both skip-path envelopes so agents see "skipped" as a first-class success signal rather than inferring "no commit happened, I must improvise" from absent `hash` / `committed:false`. Backward-compatible: existing callers reading `committed` / `hash` / `reason` are unaffected. 3. **tests/bug-3678-executor-commit-docs-respect.test.cjs** — 7-test regression covering: - A1/A2: agent prompt mentions the skip envelope AND explicitly forbids raw-git fallback (`source-text-is-the-product` exception) - B1: SDK envelope carries `committed:false`, `skipped:true`, canonical `reason: 'skipped_commit_docs_false'` (frozen enum) - B2: git index empty after commit_docs:false skip (no `.planning/` staged) - B3: HEAD unchanged after commit_docs:false skip - C1/C2: structural ban on `git add -f` / `git add --force` in any agent or workflow body (prohibition-sentence exception preserves audit prose) Verification: - node --test tests/bug-3678-*: 7/7 pass - Targeted regression (10 commit/executor-adjacent files): 135/135 pass - Full docker suite (gsd-test-summary): 11751/11740 pass / 0 fail (the 11 added are this test plus a few collateral pickups) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…Opus 4.7 (1M context) <[email protected]>)
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes issue Changescommit_docs: false respects SDK skip envelope
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agents/gsd-executor.md`:
- Around line 721-741: Update the executor logic so that responses from "gsd-sdk
query commit" with "skipped: true" (reasons 'skipped_commit_docs_false' or
'skipped_gitignored') are treated as terminal successes and do not trigger any
raw-git fallback (no git add -f, git commit, or forced metadata commits); adjust
the checklist/final-metadata-commit path to consider a prior commit result with
skipped:true as completed (record the appropriate "skipped (...)" completion
message) and skip attempting a subsequent unconditional metadata commit or
force-staging of .planning files.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: eeb72bc1-b669-49b8-9f26-755ecf60352c
📒 Files selected for processing (4)
.changeset/fix-3678-commit-docs-respect.mdagents/gsd-executor.mdget-shit-done/bin/lib/commands.cjstests/bug-3678-executor-commit-docs-respect.test.cjs
…list The new `final_commit` prose at lines 717-741 teaches the executor to treat `skipped:true` as success and forbids raw-git fallback, but the downstream completion checklist still contained an unconditional "Final metadata commit made" checkbox. An LLM executor reading an unchecked mandatory box may attempt to satisfy it via raw `git add`, re-introducing the exact regression this PR is meant to prevent. Update the checklist line to carve out the intentional-skip case and add a regression test asserting the carve-out remains present. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Fix PR
Linked Issue
Fixes #3678
What was broken
When a user set
commit_docs: falsein.planning/config.json,gsd-executorwas still emittingdocs({phase}-{plan}): complete plan summarycommits that force-staged gitignored.planning/artifacts into the user's git history. The reporter (#3678) saw a🔧 chore: stop tracking gitignored build artifactscommit appear shortly after — the agent self-correcting after it noticed the leak.What this fix does
Teaches
agents/gsd-executor.mdhow to interpret the SDK's{committed:false, skipped:true, ...}return envelope, addsskipped: trueas a first-class field on that envelope inget-shit-done/bin/lib/commands.cjs::cmdCommit, and bansgit add -f/git add --forcefrom any agent or workflow body via a regression test.Root cause
The SDK guard at
get-shit-done/bin/lib/commands.cjs:268-280correctly skips whencommit_docs:falseand returns{committed: false, hash: null, reason: 'skipped_commit_docs_false'}— no git ops happen.But the executor agent prompt at
agents/gsd-executor.md:710-720(the<final_commit>block) just instructs the LLM to callgsd-sdk query commit "docs(...)" --files .planning/...with no instruction for the skipped return. With no explicit handling, the LLM improvises: "the SDK didn't make the commit I was told to make, so I'll do it manually withgit add -f/git commit". That bypasses the gitignore and lands the regression.The only place
commit_docsappeared in the entire executor agent prompt before this PR was line 80, listing it as a JSON field to extract. Zero behavioral instructions tied to it.Testing
How I verified the fix
node --test tests/bug-3678-executor-commit-docs-respect.test.cjs— 7/7 pass. The test runs RED before either fix (3 failures across A/B), GREEN after applying the agent-prompt update AND the SDK envelope change, then I tightened a single prose line so the prohibition-sentence exception in C1 wouldn't trip on the new audit text.Regression test added?
tests/bug-3678-executor-commit-docs-respect.test.cjs(230 LOC, 7 tests across 3 describe groups). Carries// allow-test-rule: source-text-is-the-productfor the prompt/workflow body inspection.Coverage breakdown:
agents/gsd-executor.mdreferences theskippedenvelope (one of:'skipped_commit_docs_false',committed: false,skipped: true)agents/gsd-executor.mdcarries an explicit "do not fall back to raw git" / "must not fall back" / "never run git add" instructiongsd-tools commitwithcommit_docs:falsereturns{committed:false, skipped:true, reason:'skipped_commit_docs_false'}(frozen enum)git diff --cached --name-onlyshows no.planning/paths after the skipped callgit rev-parse HEADis unchanged after the skipped callgit add -f/git add --forceoutside a prohibition or audit sentence (regex windowed)Platforms tested
node --test)gsd-test-summary, hostcartographer).mdprose, a 1-lineresultfield add in JS, and a test that usesnode:fs+execFileSync('git', ...))Runtimes tested
agents/gsd-executor.md.Scope confirmation
Documentation
agents/gsd-executor.mdis the user-facing explanation.Checklist
Fixes #3678confirmed+confirmed-buglabelsgsd-test-summary11751/0).changeset/fragment addedBreaking changes
None. The SDK envelope change is purely additive: existing callers reading
committed/hash/reasoncontinue to work. The newskippedfield is opt-in. The agent prompt change adds text only, removing nothing.Discovery context
Diagnosed via the
/diagnoseskill discipline:gsd-tools commit(no LLM-in-the-loop needed — the prompt gap is statically observable).agents/gsd-executor.md:710-720; confirmed zerocommit_docs-related behavioral instructions exist in the prompt body.git add -fbaked into a workflow path) falsified by grep; H4 (SDK uses force-add) falsified by inspection ofcmdCommit.[DEBUG-*]instrumentation absent (none added); regression test prevents drift; what-would-have-prevented-this is the C1/C2 structural ban that now exists.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests