Repository navigation
fix(speckit): harden dirty-tree check with explicit AskUserQuestion tool call - #396
Merged
jflowers merged 1 commit intoJul 31, 2026
Conversation
…ool call
Replace prose-only dirty-tree guard in speckit.specify.md with an
explicit AskUserQuestion tool call presenting structured options
("Stash changes and continue" / "Abort -- keep changes as-is").
Includes git stash failure handling and stash recovery notification.
- Harden speckit.specify.md step 2 against context compression (T1+T3)
- Add OpenSpec change artifacts (proposal, design, specs, tasks)
- File follow-up issue unbound-force#395 for speckit-workflow/SKILL.md parallel guard
- Add CHANGELOG.md entry
Fixes unbound-force#358
Assisted-by: claude-opus
Generated with AI assistance (claude-opus)
jflowers
force-pushed
the
opsx/fix-speckit-dirty-tree-check
branch
from
July 31, 2026 19:51
43cd008 to
8df3b53
Compare
This was referenced Jul 31, 2026
jflowers
added a commit
that referenced
this pull request
Aug 1, 2026
…cit AskUserQuestion gate Replace the prose-only "STOP and ask the user for confirmation" instruction in speckit-workflow/SKILL.md Pre-conditions section with an explicit AskUserQuestion tool call pattern matching the sibling files hardened in PRs #396 and #406. - Add AskUserQuestion with stash/abort options - Add stash failure handling (non-zero exit → abort) - Add post-stash re-verification via git status --short - Add post-workflow stash restore reminder - Update scaffold copy in lockstep - Add OpenSpec change artifacts Fixes #395 Assisted-by: claude-opus Generated with AI assistance (claude-opus)
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.
Summary
Replaces the prose-only dirty-tree guard in
speckit.specify.md(step 2) with an explicitAskUserQuestiontool call. The previous prose instruction ("STOP and ask the user for confirmation") was vulnerable to context compression — agents could skip the check entirely and create a branch despite uncommitted changes, risking work applied to the wrong branch or lost.The hardened guard now presents two structured options:
git stash, with failure handling (non-zero exit → abort) and recovery notification at workflow completion (git stash pop)This is a T1+T3 weakness fix from audit #346. Sibling issues #350 and #353 address the same pattern in other files.
Fixes #358
How to Test
.opencode/commands/speckit.specify.mdand verify lines 40-67AskUserQuestion toolis explicitly referenced (line 44)git stashfailure handling (lines 57-59): non-zero exit → STOPgit stash popmake check— all tests pass (no Go code changed)How to Demo
This is an agent instruction hardening fix (Markdown only). To observe the behavioral change, invoke
/speckit.specifywith uncommitted changes in the working tree — the agent should now present a structuredAskUserQuestioninstead of relying on prose interpretation.Key Files Changed
.opencode/commands/speckit.specify.mdCHANGELOG.mdopenspec/changes/fix-speckit-dirty-tree-check/.openspec.yamlopenspec/changes/fix-speckit-dirty-tree-check/proposal.mdopenspec/changes/fix-speckit-dirty-tree-check/design.mdopenspec/changes/fix-speckit-dirty-tree-check/specs/dirty-tree-guard.mdopenspec/changes/fix-speckit-dirty-tree-check/tasks.mdThis PR was generated by /finale (AI-assisted).