Skip to content

fix(propose): use the requested workflow schema - #1504

Merged
clay-good merged 7 commits into
mainfrom
codex/propose-schema-selection
Aug 4, 2026
Merged

fix(propose): use the requested workflow schema#1504
clay-good merged 7 commits into
mainfrom
codex/propose-schema-selection

Conversation

@clay-good

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

Copy link
Copy Markdown
Collaborator

Status

LGTM. This is a surgical template fix with no CLI, schema, storage, or architecture changes.

What was wrong

The propose workflow always ran openspec new change "<name>", even when the user explicitly requested a non-default workflow schema. The CLI already supports --schema, so the generated agent guidance was discarding a valid user choice and creating the change with the configured default.

Schema discovery also needs to run from the selected OpenSpec root. Running openspec schemas --json from a caller project while targeting a registered store can show the wrong project-local schemas.

How it was fixed

  • Use the configured default unless the user explicitly requests another schema.
  • Pass an explicit choice as openspec new change "<name>" --schema "<schema-name>".
  • Show available workflows only when asked, after resolving the authoritative root with openspec context --json (or --store "<store-id>" for an explicit store), then run schemas from root.path.
  • Preserve pre-init discovery by falling back to the caller directory only for no_openspec_root; invalid or unavailable stores remain hard failures.
  • Preserve --store "<store-id>" on change creation and later shown OpenSpec commands that support the flag.
  • Preserve existing default behavior by omitting --schema when no explicit choice was made.
  • Regenerate the checked-in propose skill and update parity hashes.

Replication / proof

  • Added focused regression coverage for both generated propose templates, including distinct line-complete assertions for the default and explicit-schema command forms.
  • Added coverage that root resolution precedes schema discovery in both generated propose surfaces.
  • Added executable assertions that config-only store: pointers and global defaultStore sessions return the selected store as root.path.
  • Verified all generated Claude, Continue, and Cursor propose surfaces in a fresh project.
  • Verified caller-local and store-local schemas remain isolated by working directory.
  • Created a registered-store change with --schema custom-flow and confirmed .openspec.yaml records schema: custom-flow.
  • Reproduced Alfred's pointer and global-default cases: direct caller discovery showed only spec-driven; context --json resolved the store; discovery from root.path showed custom-flow; and new change --schema custom-flow succeeded in that store.
  • Verified explicit-store resolution with openspec context --json --store team-plans.
  • Verified a clean pre-init directory still lists the built-in workflow after context returns no_openspec_root.
  • Confirmed the registered-store change was not created in the caller project and that follow-up status resolution stayed in the store.
  • Confirmed generated guidance does not propagate --store to unsupported or delegated commands.
  • pnpm test: 119 files, 3,476 tests passed.
  • pnpm run lint: passed.
  • pnpm run build: passed.

Notes / nits

Summary by CodeRabbit

  • New Features

    • Propose workflows now use the configured default schema automatically.
    • Specify a schema explicitly when creating a change, or request a list of available schemas.
    • Schema discovery now respects the selected project or store location.
    • Workflow guidance and commands now clearly distinguish schema and store options.
  • Bug Fixes

    • Improved context resolution to consistently use the correct store location across session types.

@clay-good
clay-good requested a review from a team as a code owner August 3, 2026 23:13
@clay-good
clay-good requested review from alfred-openspec and removed request for a team August 3, 2026 23:13
@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

The propose skill and command templates now select a workflow schema before creating a change. They preserve the configured default, pass explicit schema names to the CLI, and list schemas on request. Tests cover schema handling, root resolution, generated content, and updated hashes.

Changes

Propose schema selection

Layer / File(s) Summary
Template schema-selection flow
src/core/templates/workflows/propose.ts
Both propose templates resolve the project or store root, list schemas when requested, pass --schema for explicit selections, preserve the configured default otherwise, and update step numbering.
Generated skill schema workflow
skills/openspec-propose/SKILL.md
The generated skill applies conditional schema handling, supports registered stores, and renumbers artifact creation and final status steps.
Template behavior and context validation
test/core/templates/propose.test.ts, test/core/templates/skill-templates-parity.test.ts, test/commands/context.test.ts
Tests validate schema selection, discovery fallbacks, store-root propagation, generated skill rendering, context roots, and template hashes.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ProposeWorkflow
  participant OpenSpecContext
  participant OpenSpecSchemas
  participant OpenSpecNewChange
  User->>ProposeWorkflow: Request a propose workflow
  ProposeWorkflow->>OpenSpecContext: Resolve project or store root
  ProposeWorkflow->>OpenSpecSchemas: Discover schemas when requested
  ProposeWorkflow->>OpenSpecNewChange: Create change with explicit schema
  ProposeWorkflow->>OpenSpecNewChange: Create change with configured default
Loading

Possibly related PRs

Suggested reviewers: tabishb

🚥 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 accurately summarizes the main change: updating the propose workflow to use requested workflow schemas instead of always defaulting.
Linked Issues check ✅ Passed Changes implement schema selection support for propose workflows by accepting explicit schemas, discovering available schemas, and preserving default behavior when no schema is specified [#770].
Out of Scope Changes check ✅ Passed All changes directly support schema selection for propose workflows. Test updates verify schema discovery, root resolution, and store propagation. No unrelated modifications present.
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/propose-schema-selection

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.

@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 explicit --schema path is good, but schema discovery still misses root selection through a config-only store: pointer or global defaultStore. In both cases openspec schemas --json from the caller showed only spec-driven, while openspec context --json resolved the store containing custom-flow and openspec new change ... --schema custom-flow succeeded; please resolve the authoritative root first (for example, context --json with explicit --store when applicable), run schemas from root.path, and cover these fallback paths.

@clay-good

Copy link
Copy Markdown
Collaborator Author

@alfred-openspec Addressed your authoritative-root review in 3248338d, with the compatibility hardening in 56cb428b.

  • Config-only store: pointers and global defaultStore now resolve through openspec context --json.
  • Explicit stores use openspec context --json --store "<store-id>".
  • Schema discovery runs from the returned root.path.
  • The only fallback is no_openspec_root, preserving valid pre-init schema discovery without masking invalid or unavailable stores.

I reproduced both reported cases end to end: caller discovery showed only spec-driven, context resolved the store, discovery from root.path showed custom-flow, and new change --schema custom-flow created the change in that store. The full suite passes: 119 files / 3,476 tests, plus lint and build.

Could you please re-review the current head?

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@clay-good I will re-review the current head. I will verify the authoritative-root resolution, the no_openspec_root fallback, and the regression coverage.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: e55086c
Status: ✅  Deploy successful!
Preview URL: https://c43c2f14.openspec-docs.pages.dev
Branch Preview URL: https://codex-propose-schema-selecti.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 c98cb88 resolves the earlier root-selection blocker. Schema discovery now resolves context first, honors explicit stores plus local store pointers and global defaults, and only falls back on no_openspec_root; a fresh build and 41 focused context/propose/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. Authoritative schema-root resolution still covers explicit stores, local store pointers, global defaults, and the rootless fallback; 49 focused context/propose/parity tests pass locally, 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 f43fe0e Aug 4, 2026
16 checks passed
@clay-good
clay-good deleted the codex/propose-schema-selection branch August 4, 2026 20:44
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.

[Feature Request] Support schema selection in propose/new skills and commands

2 participants