Skip to content

fix(apply): surface deferred scope instead of silently simplifying tasks - #1530

Open
clay-good wants to merge 5 commits into
mainfrom
claude/openspec-backlog-triage-b9df58
Open

fix(apply): surface deferred scope instead of silently simplifying tasks#1530
clay-good wants to merge 5 commits into
mainfrom
claude/openspec-backlog-triage-b9df58

Conversation

@clay-good

@clay-good clay-good commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Status

LGTM — passed multiple rounds of parallel adversarial review (semantics/over-pause, docs consistency, regen determinism, merge-readiness, repo-wide drift, behavioral robustness) plus the full test suite.

Closes #1529.

What was wrong

The /opsx:apply guidance told agents to "keep going through tasks until done or blocked" but never said what to do when a task needed work beyond what the spec described. So agents absorbed the extra scope silently — narrowing it, deferring it, or accepting partial work — and still marked the task - [x]. The change then looked done while important, specified work was never implemented (#1529).

What it does

Adds one pause trigger and two guardrails to the shared apply instructions (getApplyInstructions()), which both the skill and command surfaces render, so they can't drift. The trigger is deliberately anchored to a change in scope, not to effort (a hard-but-specified task should not trip it):

  • Pause if: a task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, or defer specified behavior to make it fit → surface the added scope and ask; do not absorb it silently.
  • Guardrail: when a task needs work beyond what the spec describes, surface the added scope and pause — never silently narrow, defer, or simplify away specified behavior.
  • Guardrail: only mark a task - [x] when its specified behavior is fully implemented, not when it is partially done or deferred.

Guidance text only — no behavioral code paths change. The static skills/openspec-apply-change/SKILL.md and the three parity-hash pins were regenerated with the repo's own generate:skills / regen:parity-hashes scripts (the only three hashes that change are the two apply surfaces and the apply skill content).

Proof it works

  • New test/core/templates/apply-defer-guardrail.test.ts asserts the guidance is present in getApplyInstructions() and on both surfaces; a full revert removes every asserted string, so it fails correctly.
  • npm run generate:skills + npm run regen:parity-hashes on the committed tree produce zero further diff — the generated artifacts match the source exactly (verified deterministic across repeated runs).
  • Template, shared, skills, parity, and equivalence suites all green; tsc --noEmit and eslint clean.

Notes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Workflow Improvements

    • Apply workflows now surface unexpected complexity and pause for guidance instead of silently narrowing, deferring, or simplifying requested work.
    • Tasks are marked complete only after the specified behavior is fully implemented.
  • Tests

    • Added coverage to verify consistent guidance across apply workflows, skills, and commands.

The /opsx:apply guidance told agents to keep going through tasks but never
told them what to do when a task turned out harder than the spec assumed.
Agents absorbed the extra scope silently — narrowing, deferring, or
declaring partial work done — and marked the task complete anyway (#1529).

Add a pause trigger and two guardrails to the shared apply instructions
(rendered identically by the skill and command surfaces): surface the added
scope and ask rather than simplify to fit, and mark a task complete only
when it is fully implemented as specified. Regenerate the static skill and
parity-hash pins. Guidance text only — no behavioral code paths change.

Fixes #1529

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@clay-good
clay-good requested a review from a team as a code owner August 6, 2026 17:45
@clay-good
clay-good requested review from TabishB and removed request for a team August 6, 2026 17:45
@coderabbitai

coderabbitai Bot commented Aug 6, 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: ea0ba6d6-32cc-4310-ad51-31fa33dd8e8d

📥 Commits

Reviewing files that changed from the base of the PR and between 844953d and 4d224a1.

📒 Files selected for processing (1)
  • test/core/templates/apply-defer-guardrail.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/core/templates/apply-defer-guardrail.test.ts

📝 Walkthrough

Walkthrough

The apply workflow now requires agents to report unexpected scope, pause for guidance, avoid silent simplification or deferral, and mark tasks complete only after full implementation. Tests cover the skill and command templates, with updated parity hashes and a patch changeset.

Changes

Apply scope guardrails

Layer / File(s) Summary
Scope and completion guidance
.changeset/apply-surface-deferred-scope.md, skills/openspec-apply-change/SKILL.md, src/core/templates/workflows/apply-change.ts
Apply guidance now requires reporting unexpected complexity, pausing for guidance, and completing tasks only when fully implemented.
Guardrail and parity validation
test/core/templates/apply-defer-guardrail.test.ts, test/core/templates/skill-templates-parity.test.ts
Tests verify the guidance across apply surfaces. Parity hashes now match the updated templates.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: tabishb, alfred-openspec

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 primary change: preventing silent simplification or deferral in the apply workflow.
Linked Issues check ✅ Passed The changes address issue #1529 by requiring agents to surface added scope, pause for guidance, and complete tasks only after full implementation.
Out of Scope Changes check ✅ Passed All changes support the linked issue through apply guidance, generated surfaces, parity updates, and regression tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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 claude/openspec-backlog-triage-b9df58

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: 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 `@test/core/templates/apply-defer-guardrail.test.ts`:
- Around line 14-17: Update the assertions in the apply-defer guardrail test to
require the exact phrase “surface the added scope and pause” for both rendered
instruction surfaces, while preserving the existing checks prohibiting silent
simplification or deferment. Align the test with the corresponding requirement
in the apply-change workflow template.
🪄 Autofix

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: d384c31a-06f7-4c61-97f6-bd92ed705c9e

📥 Commits

Reviewing files that changed from the base of the PR and between d578896 and 917dc78.

📒 Files selected for processing (5)
  • .changeset/apply-surface-deferred-scope.md
  • skills/openspec-apply-change/SKILL.md
  • src/core/templates/workflows/apply-change.ts
  • test/core/templates/apply-defer-guardrail.test.ts
  • test/core/templates/skill-templates-parity.test.ts

Comment on lines +14 to +17
it('tells the agent to surface added scope rather than defer or simplify', () => {
expect(instructions).toContain('surface the added scope');
expect(instructions).toMatch(/never silently simplify, defer/);
});

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the pause requirement explicitly.

The test checks that the instructions surface added scope and prohibit silent simplification or deferment. It does not check that the agent pauses. The test could pass if the workflow reports the added scope and then continues without waiting for guidance.

Add surface the added scope and pause to the single-surface assertion and use the same phrase for both rendered surfaces. The production requirement is in src/core/templates/workflows/apply-change.ts, Lines 181-182.

Proposed assertion update
-    expect(instructions).toContain('surface the added scope');
+    expect(instructions).toContain('surface the added scope and pause');
...
-    const needle = 'surface the added scope';
+    const needle = 'surface the added scope and pause';

This follows the PR objective that unexpected scope must pause the workflow.

Also applies to: 23-26

🤖 Prompt for 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.

In `@test/core/templates/apply-defer-guardrail.test.ts` around lines 14 - 17,
Update the assertions in the apply-defer guardrail test to require the exact
phrase “surface the added scope and pause” for both rendered instruction
surfaces, while preserving the existing checks prohibiting silent simplification
or deferment. Align the test with the corresponding requirement in the
apply-change workflow template.

clay-good and others added 4 commits August 6, 2026 12:58
Adversarial review flagged that "more complex than the spec assumed" could
be read as "takes more effort than I guessed," which would make an agent
pause on nearly every task. Retie the pause trigger and guardrail to a
change in scope — work beyond what the spec/tasks describe, or dropping /
narrowing / deferring specified behavior — so normal implementation effort
does not trip it. Regenerate the static skill and parity pins; update the
regression test and changeset to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…idance

Issue #1529's concrete example is an agent that found three exceptions to a
"zero writes on the main thread" task, declared them "accepted," and moved
on. Add "accept exceptions to" to the pause trigger's verb list so the
guidance names that exact failure mode, not just drop/narrow/defer. Behavior
is otherwise unchanged; regenerate the static skill and parity pins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CodeRabbit noted the guardrail test checked that added scope is surfaced but
not that the agent pauses, so it could pass if the workflow reported scope and
kept going. Assert the exact "surface the added scope and pause" phrasing.

Co-Authored-By: Claude Opus 4.8 <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.

This correctly anchors the pause to scope changes rather than effort, keeps the approved artifacts authoritative, and requires full specified behavior before checking a task off. Exact-head build, lint, focused guidance/parity tests, and regeneration are clean.

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.

AI Agents have on occasion "simplified" tasks or deferred work without surfacing it to the user when applying a change through tasks

2 participants