Skip to content

fix(explore): scaffold changes before capturing artifacts - #1503

Merged
clay-good merged 6 commits into
mainfrom
codex/scaffold-explore-transitions
Aug 4, 2026
Merged

fix(explore): scaffold changes before capturing artifacts#1503
clay-good merged 6 commits into
mainfrom
codex/scaffold-explore-transitions

Conversation

@clay-good

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

Copy link
Copy Markdown
Collaborator

Status

LGTM.

What was wrong

Explore mode could offer to capture an idea as a proposal without first scaffolding a change. An agent could create files directly under openspec/changes/, omit the required .openspec.yaml, or make the user invoke another workflow command to finish the capture.

How it was fixed

  • Require openspec new change before any new-change artifacts are written and retain the selected store on follow-up commands.
  • Continue the accepted capture through status and artifact instructions, in dependency order.
  • Apply completed dependency context and artifact-specific rules without copying those constraints into output.
  • Handle conditional prerequisites without deadlocking or writing a blocked artifact before loading its instructions.
  • Honor delegated skills/commands and glob output paths, and ask before adding non-conditional prerequisites the user did not request.
  • Keep existing-change artifact updates unchanged.

This changes generated guidance only. It does not change CLI behavior, APIs, schemas, persisted data, or architecture.

Replication / proof

The new regression assertions failed on current main because neither explore delivery surface required scaffolding or carried the transition through artifact creation. They pass with this patch.

  • 3,480/3,480 tests passed across 119 test files.
  • 1,170 focused explore, parity, adapter, and initialization tests passed.
  • ESLint, TypeScript build, generated-skill parity, and git diff --check passed.
  • A fresh Claude, GitHub Copilot, and Trae initialization generated all 6 explore skill/command surfaces with the scaffold and artifact-capture guidance.
  • Three independent adversarial review tracks repeatedly covered issue/PR overlap, compatibility, prompt semantics, and test strength. All findings were fixed; final re-reviews reported no remaining actionable issues.
  • CodeRabbit's test-hardening nit was addressed with scoped order/count assertions and explicit start-only coverage.

Notes / nits

Open PRs #1017 and #1500 touch the same template/parity or generated-skill files for unrelated guidance, so whichever lands second may need a mechanical rebase.

CodeRabbit linked-issue note: the additional ideas discussed in #720 are intentionally out of scope. The issue follow-up explains that rules.design is artifact-scoped and cannot guard Explore, while an FF metadata check would be an optional defensive follow-up. This PR fixes the reported failure at its source by requiring openspec new change before Explore captures artifacts, which creates .openspec.yaml.

Closes #668.
Closes #720.

Summary by CodeRabbit

  • New Features
    • Exploration guidance now supports capturing ideas as structured changes through the OpenSpec CLI.
    • Workflows guide artifact creation in dependency order, including conditional prerequisites, status checks, and completion verification.
  • Bug Fixes
    • Preserves required change metadata and selected storage settings during exploration.
    • Prevents manually created change directories and unintended implementation during exploration.
  • Tests
    • Added coverage for scaffolding, artifact sequencing, status refreshes, output verification, and template consistency.

@clay-good
clay-good requested a review from a team as a code owner August 3, 2026 22:27
@clay-good
clay-good requested review from alfred-openspec and removed request for a team August 3, 2026 22:27
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Explore mode now supports capturing accepted exploration as a scaffolded OpenSpec change. The guidance requires openspec new change, preserves .openspec.yaml, creates artifacts in dependency order, refreshes status, and verifies outputs.

Changes

Explore change capture

Layer / File(s) Summary
Capture workflow guidance
skills/openspec-explore/SKILL.md
Explore mode permits artifact creation but prohibits implementation. The skill defines CLI scaffolding, ordered artifact creation, verification, and a guardrail against manual change directories.
Explore workflow templates
src/core/templates/workflows/explore.ts, .changeset/scaffold-explore-transitions.md
Both explore templates require CLI scaffolding before artifact capture. They document status checks, dependency order, output verification, and generated metadata preservation.
Workflow regression validation
test/core/templates/explore.test.ts, test/core/templates/skill-templates-parity.test.ts
Tests cover both delivery surfaces, workflow ordering, metadata preservation, artifact sequencing, conditional prerequisites, status refreshes, output verification, and updated template hashes.

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

Possibly related PRs

Suggested reviewers: tabishb, alfred-openspec

Sequence Diagram(s)

sequenceDiagram
  participant ExploreWorkflow
  participant OpenSpecCLI
  participant ChangeArtifacts
  ExploreWorkflow->>OpenSpecCLI: Run openspec new change
  OpenSpecCLI-->>ExploreWorkflow: Return scaffolded change and .openspec.yaml
  ExploreWorkflow->>OpenSpecCLI: Query status and instructions
  OpenSpecCLI-->>ExploreWorkflow: Return artifact order and context
  ExploreWorkflow->>ChangeArtifacts: Create requested artifacts
  ExploreWorkflow->>OpenSpecCLI: Refresh status and verify outputs
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR satisfies #668 and the explore-skill portion of #720, but it omits #720's project-rule and ff guardrail requirements. Add the project rule and ff guardrail required by #720, then update related tests and generated parity artifacts as needed.
✅ 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: Explore mode now scaffolds changes before capturing artifacts.
Out of Scope Changes check ✅ Passed The changes are limited to Explore guidance, regression tests, generated parity hashes, and the related changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 codex/scaffold-explore-transitions

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.

🧹 Nitpick comments (1)
test/core/templates/explore.test.ts (1)

82-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert workflow order and branch coverage.

These checks verify that required phrases exist, but not their order or repetition. A future edit could move openspec instructions before the initial status query, remove the status refresh, or drop the start-only and blocked-prerequisite behavior while the test remains green. Assert the sequence and occurrence counts for scaffold, status, instructions, output verification, and status refresh. Add coverage for the two branch conditions.

As per coding guidelines, run focused file testing with pnpm exec vitest run test/core/templates/explore.test.ts.

Also applies to: 101-112

🤖 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/explore.test.ts` around lines 82 - 99, Strengthen the
tests around the bodies loop in the accepted-transition test to assert workflow
ordering and occurrence counts for scaffold, initial status, instructions,
output verification, and status refresh rather than only phrase presence. Add
focused coverage for start-only and blocked-prerequisite branches, and run the
file with pnpm exec vitest run test/core/templates/explore.test.ts.

Source: Coding guidelines

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

Nitpick comments:
In `@test/core/templates/explore.test.ts`:
- Around line 82-99: Strengthen the tests around the bodies loop in the
accepted-transition test to assert workflow ordering and occurrence counts for
scaffold, initial status, instructions, output verification, and status refresh
rather than only phrase presence. Add focused coverage for start-only and
blocked-prerequisite branches, and run the file with pnpm exec vitest run
test/core/templates/explore.test.ts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2fc9466f-c23d-4785-a815-932aca027eef

📥 Commits

Reviewing files that changed from the base of the PR and between 45cca5d and 51e8f19.

📒 Files selected for processing (5)
  • .changeset/scaffold-explore-transitions.md
  • skills/openspec-explore/SKILL.md
  • src/core/templates/workflows/explore.ts
  • test/core/templates/explore.test.ts
  • test/core/templates/skill-templates-parity.test.ts

alfred-openspec
alfred-openspec previously approved these changes Aug 3, 2026

@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.

Clean fix. The generated explore guidance now scaffolds metadata before capture, preserves store selection, and follows dependency-aware status/instructions without turning exploration into implementation. Full CI is green.

@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.

The conditional-prerequisite refinement looks good, but this commit also dropped the guidance and test that keep the selected --store on follow-up status and instructions calls. From a directory with only a registered store, the generated sequence now scaffolds the change in that store and then fails immediately at status with no_root_with_registered_stores; please restore store propagation and its regression assertion for every applicable follow-up command.

@clay-good

Copy link
Copy Markdown
Collaborator Author

Addressed the outstanding review feedback in 20b938f:

  • Restored explicit --store <id> propagation for every follow-up status and instructions call, with regression coverage proving the guidance appears before the first follow-up.
  • Strengthened the capture tests with workflow ordering and occurrence counts for scaffold, status, both instruction paths, output verification, and status refresh, plus start-only and blocked-prerequisite coverage.
  • Hardened the transition further so directly requested conditional artifacts evaluate their own instruction condition before creation and can be deliberately skipped when it does not apply.
  • Updated generated-skill parity hashes.

Verification: 3,481/3,481 tests passed across 119 test files; focused explore/parity tests, ESLint, TypeScript build, and git diff --check also passed.

@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 `@skills/openspec-explore/SKILL.md`:
- Around line 111-114: Update the command examples in the openspec workflow
instructions so every follow-up status and instructions invocation propagates
the confirmed store ID when a standalone store was selected, while local-root
examples omit any unbound --store placeholder. Apply the same conditional store
wording to the dependency instructions call and the status refresh in step 4,
then update the generator or template and regenerate SKILL.md.
🪄 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: 5b858bdc-b1b6-4f0c-aaf3-d020e1f3c206

📥 Commits

Reviewing files that changed from the base of the PR and between 6347ff8 and 20b938f.

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

Comment thread skills/openspec-explore/SKILL.md Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploying openspec-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: af9834a
Status: ✅  Deploy successful!
Preview URL: https://ecb920ae.openspec-docs.pages.dev
Branch Preview URL: https://codex-scaffold-explore-trans.openspec-docs.pages.dev

View logs

alfred-openspec
alfred-openspec previously approved these changes Aug 4, 2026

@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.

Exact head ebf13c5 is clean. The selected standalone store now propagates through all five applicable status and instructions follow-ups while local-root commands remain unqualified; a fresh build and 31 focused explore/parity tests pass, with hosted CI green.

@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.

Re-reviewed the rebased head. The explore capture transition still scaffolds metadata first, respects conditional prerequisites, and preserves a selected standalone store across every applicable follow-up command. A fresh build and all 35 focused explore/parity tests pass, and the full hosted matrix is green.

@clay-good
clay-good added this pull request to the merge queue Aug 4, 2026
Merged via the queue into main with commit 8a3850d Aug 4, 2026
16 checks passed
@clay-good
clay-good deleted the codex/scaffold-explore-transitions branch August 4, 2026 21:31
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.

Improve explore → change transition guidance in skills /opsx-explore behavior

2 participants