Skip to content

impl: v2-phase-2 (b — lane) - #146

Draft
yihanzhu wants to merge 1 commit into
mainfrom
codex/v2-phase-2-lane
Draft

impl: v2-phase-2 (b — lane)#146
yihanzhu wants to merge 1 commit into
mainfrom
codex/v2-phase-2-lane

Conversation

@yihanzhu

Copy link
Copy Markdown
Owner

PR B of work/v2-phase-2/plan.md: the autonomous lane, two stage skills, and the three named docs.

What changed

  • spec-on-intent.yml drafts one hash-linked spec per pending intent. It is idempotent, draft-locks updates, refuses approved/stale PRs, and asserts the exact branch head and one-file diff.
  • implement-on-spec.yml commits the plan first, commits code second, verifies the exact head in a credential-free no-network sandbox, then publishes through a separate command-only action.
  • review-on-pr.yml loads its workflow, skill, and policy from trusted main, snapshots the PR as data, gives the model one temporary output file, and posts/asserts one head/base-marked comment in a plain step.
  • /implement and /review-pr carry the stage boundaries, model policy, proof rules, and comments-only rail.
  • README, QUICKSTART, and work/README.md now describe both lanes and the setup needed for the autonomous one.

Do not merge yet

This is a draft because the live repository does not yet meet the setup documented in QUICKSTART:

  1. Move CLAUDE_CODE_OAUTH_TOKEN from the repository secret to a ystack-lane environment restricted to main, then delete the repository-level copy.
  2. Set the YSTACK_OPERATOR repository variable.
  3. Add workflow-execution actor/event rules and protect ystack/spec/* and ystack/impl/* from other writers.

Two implementation choices also need the operator's explicit ruling because the accepted plan names a different event:

  • The pinned Claude action rejects push. The path-filtered push run is therefore the quota record; the agent starts from the supported workflow_run event after the same commit passes ci.
  • A secret-bearing pull_request workflow executes PR-authored workflow code. Review therefore uses pull_request_target, checks out only main, and reads the PR only through the API.

The user's eight-file boundary also conflicts with the repo's full-backup rule: the five new load-bearing files are not yet in ci/required-files.txt. RESTORE.md still calls the OAuth workflow optional, and v2 artifacts still carry no issue ID that generated PRs can use for Closes #…. Those need an operator ruling or a follow-up change before this can be called merge-ready.

Verify evidence

verified-head: 3f09898ddd55ad6fc128e0954ffac17c1c9aadc0

ShellCheck 0.11.0 over every checkout .sh file: clean
scripts/test/codex-degraded-gate.test.sh: 91 passed, 0 failed
scripts/test/models-conf-parser.test.sh: 63 passed, 0 failed
scripts/test/north-star-gate.test.sh: 226 passed, 0 failed
scripts/test/north-star-resolver.test.sh: 74 passed, 0 failed
scripts/test/v2-check-rename.test.sh: 13 passed, 0 failed; wrapper guards clean
scripts/test/v2-pending-stage.test.sh: all cases passed
scripts/test/v2-quota-preflight.test.sh: all cases passed
scripts/test/v2-round-cap.test.sh: all cases passed
structure check: structure ok
rename gate: clean
embedded spec/implementation publishers, ShellCheck 0.11.0: clean
workflow YAML parsing: all three ok
actionlint 1.7.12 with queue fields masked: clean

Unmasked actionlint reports only queue: max; v1.7.12 predates that current GitHub syntax. No other workflow finding remains.

New commits make this evidence stale.

Closes #144

@yihanzhu

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f09898ddd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +718 to +720
--tools "Read,Write,Edit,Grep,Glob,Bash"
--allowedTools "Read,Write,Edit,Grep,Glob,Bash(${{ runner.temp }}/implement-publish.sh:*)"
--disallowedTools "Read(/.git/**),Write(/.git/**),Edit(/.git/**),Write(/.github/**),Edit(/.github/**),Write(/.claude/**),Edit(/.claude/**),Write(/AGENTS.md),Edit(/AGENTS.md),Write(/CLAUDE.md),Edit(/CLAUDE.md),Write(/REVIEW.md),Edit(/REVIEW.md),Write(/work/**/intent.md),Edit(/work/**/intent.md),Write(/work/**/spec.md),Edit(/work/**/spec.md),Bash(git push:*),Bash(gh pr create:*),Bash(gh pr edit:*),Bash(gh pr comment:*),Bash(gh api:*)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge [Security/Important] Isolate the build model from write credentials

The build action has repository-write credentials while granting the model unrestricted Write and Edit; the denylist protects selected repository paths but not files such as $HOME/.gitconfig. Artifact text can therefore make the model configure a Git hook or filter and edit an executable that the allowed publisher's git status or git commit runs, escaping the tool allowlist with the action token. Run this model step without write credentials, or run every Git command with isolated config and disabled hooks before a separate trusted publisher receives credentials.

AGENTS.md reference: AGENTS.md:L84-L90

Useful? React with 👍 / 👎.

Comment on lines +173 to +177
if [ "$EVENT_NAME" = workflow_run ] && [ "$base_sha" != "$EVENT_HEAD_SHA" ]; then
green="$(gh run list --workflow ci.yml --event push --commit "$base_sha" \
--status success --limit 10 --json databaseId --jq 'length')"
if [ "$green" -eq 0 ]; then
echo "Main advanced to a push whose ci is not green yet; its completion will retry."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge [Bugs/Important] Retry pending work after main advances

When main advances after this run's triggering merge but the newer commit's CI is still running, this exits and assumes that CI completion will retry the stage. If the newer commit did not touch a spec, however, its matching path-filtered implement-on-spec push run does not exist, so the later workflow_run is rejected by the “Confirm the matching path-filtered push run” step and the pending implementation remains stranded until a manual dispatch or another spec merge. The same race exists in spec-on-intent.yml; the retry must scan pending work after the newer CI succeeds or wait within the original run.

Useful? React with 👍 / 👎.

github.event.pull_request.base.ref == github.event.repository.default_branch &&
(github.actor == vars.YSTACK_OPERATOR || github.actor == 'claude[bot]') &&
(github.triggering_actor == vars.YSTACK_OPERATOR || github.triggering_actor == 'claude[bot]') &&
format('review-pr-{0}-{1}', github.event.pull_request.number, github.event.pull_request.head.sha) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge [Bugs/Important] Cancel reviews by PR rather than head

Including the head SHA in this concurrency key gives every synchronize event a different group, so cancel-in-progress cannot cancel the review of the previous head. That stale review can hold the global claude-quota slot until it eventually fails the moved-head check, delaying the review of the current commit and consuming an unnecessary model run. Key the cancellable group by PR number only; the posted marker can still record the reviewed head.

Useful? React with 👍 / 👎.

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.

work/README.md: say one OPEN PR per slug

1 participant