Skip to content

fix(templates): auto-select the only active change instead of always prompting - #1468

Merged
clay-good merged 4 commits into
mainfrom
fix/single-change-autoselect
Jul 28, 2026
Merged

fix(templates): auto-select the only active change instead of always prompting#1468
clay-good merged 4 commits into
mainfrom
fix/single-change-autoselect

Conversation

@clay-good

@clay-good clay-good commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Closes #679

Status: LGTM — full suite green (2,301 tests), specs validated, e2e-inspected generated output, three independent adversarial reviews run and their one finding fixed.

What was wrong: Invoking /opsx:continue (or update, verify, sync, archive) without a change name always stalled on "which change?" — even when only one active change existed, so there was only one possible answer. The templates' step 1 said "Do NOT guess or auto-select a change. Always let the user choose," which also contradicted their own Input line ("check if it can be inferred from conversation context"). #679 describes exactly this: fire the command, walk away, come back to find nothing happened. Meanwhile /opsx:apply has inferred and auto-selected since #513.

How it was fixed: The five workflows now use apply's exact selection step: use the provided name → infer from conversation context → auto-select when exactly one active change exists → prompt only when genuinely ambiguous — and always announce Using change: <name> with how to override. Each workflow keeps its own presentation hints for the prompt path (recent-first options for continue/update, task-bearing changes for verify, delta-bearing changes for sync, active changes for archive). Bulk archive intentionally keeps its always-prompt behavior (multi-select is inherently interactive). Main specs for the archive/verify/sync skills and the active add-update-workflow change were updated in the same commit, plus a changeset.

Proof it works:

  • pnpm vitest run: 113 files, 2,301 tests pass (parity hashes and committed skills/*/SKILL.md regenerated).
  • openspec validate --specs --all and openspec validate add-update-workflow pass (the one schema-alias-support failure is pre-existing and identical on clean main).
  • e2e: openspec init --tools claude,codex in a fresh project — no generated file retains the old guardrail; the new selection step renders correctly in both skills and commands.
  • Three adversarial reviews (completeness, user-breakage, coherence). Two could not refute the change; one caught a stale archive guardrail ("Always prompt for change selection if not provided") contradicting the new step — fixed. The breakage review confirmed the only new zero-prompt path (archiving a sole, fully-complete change) matches what openspec archive <name> without --yes already does, and archive's completion/sync confirmation gates are untouched.

Notes: Guidance-only — no CLI code paths change; users pick the new prompts up via openspec update. #663 looks adjacent but is a different defect (agent running ahead of /opsx:continue), so it is not claimed here.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Behavior Improvements

    • Continue, update, verify, sync, and archive now infer the target change from conversation context or auto-select when exactly one active change exists.
    • When ambiguous, the agent prompts only then, showing a short list of most-recently-modified active options with a recommended choice.
    • The selected change is always announced (“Using change: ”) with an override hint; verify prompts only list changes with implementation tasks.
    • Bulk archive behavior is unchanged (still always prompts).
  • Documentation / Tests

    • Updated workflow/spec guidance and adjusted template parity test hashes.

…prompting

The continue, update, verify, sync, and archive workflows told agents
'Do NOT guess or auto-select a change. Always let the user choose', which
contradicted their own Input line ('check if it can be inferred from
conversation context') and stalled every invocation on a question with a
single possible answer when only one change was active. Align them with
the selection pattern /opsx:apply has used since #513: use the provided
name, infer from context, auto-select a sole active change, prompt only
when ambiguous, and always announce the selection with how to override.
Bulk archive keeps its always-prompt behavior.

Closes #679

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@clay-good
clay-good requested a review from a team as a code owner July 28, 2026 01:10
@clay-good
clay-good requested review from alfred-openspec and removed request for a team July 28, 2026 01:10
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 950a2268-4385-45b7-8e7b-bd1c4e234966

📥 Commits

Reviewing files that changed from the base of the PR and between 556560a and 587659b.

📒 Files selected for processing (4)
  • skills/openspec-sync-specs/SKILL.md
  • src/core/templates/workflows/archive-change.ts
  • src/core/templates/workflows/sync-specs.ts
  • test/core/templates/skill-templates-parity.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/core/templates/workflows/sync-specs.ts
  • src/core/templates/workflows/archive-change.ts
  • skills/openspec-sync-specs/SKILL.md
  • test/core/templates/skill-templates-parity.test.ts

📝 Walkthrough

Walkthrough

Workflow change-selection guidance now infers from context, auto-selects a sole active change, prompts only when ambiguous, and announces the selection with an override hint across archive, continue, sync, update, and verify workflows.

Changes

Change selection behavior

Layer / File(s) Summary
Workflow selection contracts
openspec/changes/..., openspec/specs/..., .changeset/...
Specifications and release metadata define inference, single-active-change auto-selection, filtered prompts, and override announcements.
Generated workflow selection guidance
src/core/templates/workflows/*
Workflow templates apply the updated selection flow to skill and OPSX command variants.
Skill-level selection instructions
skills/openspec-*-change/SKILL.md, skills/openspec-sync-specs/SKILL.md
Checked-in skill instructions document conditional selection, prompt filtering, recommendation ordering, and selection announcements.
Template parity expectations
test/core/templates/skill-templates-parity.test.ts
Golden hashes are updated for serialized templates and generated skill content.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Agent
  participant WorkflowSkill
  participant ConversationContext
  participant OpenSpecList
  Agent->>WorkflowSkill: invoke workflow without change name
  WorkflowSkill->>ConversationContext: infer target change
  ConversationContext-->>WorkflowSkill: target or ambiguous result
  WorkflowSkill->>OpenSpecList: list filtered changes when ambiguous
  OpenSpecList-->>Agent: candidate changes
  Agent-->>WorkflowSkill: choose or confirm change
  WorkflowSkill-->>Agent: announce Using change and override hint
Loading

Possibly related PRs

Suggested reviewers: tabishb, alfred-openspec

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: auto-selecting the only active change instead of always prompting.
Linked Issues check ✅ Passed The PR satisfies #679 by auto-selecting the sole active change across the affected workflows and prompting only when ambiguous.
Out of Scope Changes check ✅ Passed The changes stay focused on workflow templates, related specs, and matching test hashes; no unrelated scope is evident.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/single-change-autoselect

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 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 `@openspec/changes/add-update-workflow/design.md`:
- Around line 35-37: Update the selection flow described under
openspec/changes/add-update-workflow/design.md lines 35-37 to require announcing
“Using change: <name>” after selecting a change and documenting how an explicit
override changes selection. Add the same announcement and override behavior as
normative scenario conditions in
openspec/changes/add-update-workflow/specs/opsx-update-skill/spec.md lines 9-11,
keeping both descriptions aligned.

In `@skills/openspec-verify-change/SKILL.md`:
- Line 31: Update the override hint in the announcement text to use the public
`/opsx:verify <other>` command instead of `/openspec-verify-change <other>`,
while preserving the existing change-name announcement.

In `@src/core/templates/workflows/continue-change.ts`:
- Around line 22-37: Update the change-selection logic to inspect and count
active candidates before choosing: use the named or context-inferred change when
available, auto-select the sole active candidate, and prompt only when multiple
active candidates remain; remove unconditional prompt wording and retain the
required selection announcement and override guidance. Apply this logic at
src/core/templates/workflows/continue-change.ts lines 22-37 and 140-155, and
skills/openspec-verify-change/SKILL.md lines 20-25, with identical behavior at
each site.

In `@src/core/templates/workflows/sync-specs.ts`:
- Around line 24-33: Filter active changes by each workflow’s eligibility
criteria before resolving selection ambiguity: sync-specs flows in
src/core/templates/workflows/sync-specs.ts at lines 24-33 and 234-243 must use
only changes with delta specs, while verify-change flows in
src/core/templates/workflows/verify-change.ts at lines 22-33 and 197-208 must
use only changes with implementation tasks. Auto-select one eligible candidate,
prompt for multiple, and report no eligible candidate for none; update
skills/openspec-sync-specs/SKILL.md lines 22-31 to preserve the same sync
selection contract.
🪄 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: 89a12ef2-596d-4ba6-9fb3-672a9acbdef5

📥 Commits

Reviewing files that changed from the base of the PR and between d32d49f and b76a7d6.

📒 Files selected for processing (17)
  • .changeset/single-change-autoselect.md
  • openspec/changes/add-update-workflow/design.md
  • openspec/changes/add-update-workflow/specs/opsx-update-skill/spec.md
  • openspec/specs/opsx-archive-skill/spec.md
  • openspec/specs/opsx-verify-skill/spec.md
  • openspec/specs/specs-sync-skill/spec.md
  • skills/openspec-archive-change/SKILL.md
  • skills/openspec-continue-change/SKILL.md
  • skills/openspec-sync-specs/SKILL.md
  • skills/openspec-update-change/SKILL.md
  • skills/openspec-verify-change/SKILL.md
  • src/core/templates/workflows/archive-change.ts
  • src/core/templates/workflows/continue-change.ts
  • src/core/templates/workflows/sync-specs.ts
  • src/core/templates/workflows/update-change.ts
  • src/core/templates/workflows/verify-change.ts
  • test/core/templates/skill-templates-parity.test.ts

Comment thread openspec/changes/add-update-workflow/design.md Outdated
Comment thread skills/openspec-verify-change/SKILL.md
Comment thread src/core/templates/workflows/continue-change.ts
Comment thread src/core/templates/workflows/sync-specs.ts
…ction contract

CodeRabbit noted the add-update-workflow delta spec and design sketch
adopted auto-selection without the 'Using change: <name>' announcement
the other selection contracts require. Add the same announce-and-override
clause so the update skill's contract matches the template it describes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@alfred-openspec alfred-openspec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 556560a. Continue, update, verify, sync, and archive now match apply selection semantics: explicit name, context inference, sole-active-change auto-selection, ambiguity prompt, and announced override; bulk archive remains interactive. 19 focused tests, strict validation, all-tool generation with no stale guardrail, the 2,301-test cross-platform suite, CodeQL, audit, dependency review, and release tracking all pass.

@clay-good
clay-good added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jul 28, 2026
…oselect

# Conflicts:
#	test/core/templates/skill-templates-parity.test.ts

@alfred-openspec alfred-openspec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 587659b. The main merge preserves the explicit/context/sole-active/ambiguous selection ladder, announced override behavior, and bulk archive’s interactive contract while incorporating the newer sync-subset and YAML safeguards. Build, lint, 26 focused parity/template tests, strict validation of all 36 specs and add-update-workflow, generated-skill parity, all-tool generation, the cross-platform suite, CodeQL, audit, dependency review, and release tracking all pass.

@clay-good
clay-good added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit fc886af Jul 28, 2026
16 checks passed
@clay-good
clay-good deleted the fix/single-change-autoselect branch July 28, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent always ask what change I mean even if there is only one

2 participants