Skip to content

fix: launch readiness — a scaffold that stands alone, docs that promise what ships - #135

Merged
radiusred-cody[bot] merged 6 commits into
mainfrom
task/131-launch-readiness-a-scaffold-that-stands
Aug 26, 2026
Merged

radiusred-cody[bot] merged 6 commits into
mainfrom
task/131-launch-readiness-a-scaffold-that-stands

Conversation

@radiusred-cody

Copy link
Copy Markdown
Contributor

Closes #131 — M6-R9. From the Codex pre-launch scan (attached to #131), verified against the code.

What

  • A scaffold that stands alone. Everything init writes now resolves from an adopter's repo: the scaffolded AGENTS.md's dispatch-prompt pointer and the implementer contract's protocol and token-script references are upstream URLs (https://github.com/radiusred/gh-codecrew/blob/main/…); the contract says the codecrew-token script is copied from upstream until an identity token verb exists (Backlog capture: a codecrew identity token <slug> verb, so adopters do not copy scripts/codecrew-token from upstream #132). TestScaffoldReferencesResolveUpstream scaffolds with the real embed and rejects any hub-relative reference. The hub's own contract changes identically (it is the embedded one; the release re-embeds).
  • --help is not a failure on any verb: flag.ErrHelp maps to exit 0, and positional verbs (milestone close --help, checkpoint -h) print usage and exit 0 instead of "bad milestone number". TestHelpIsNotAnError covers six shapes.
  • init's next step says what it did: every seat is routed to ~; how to hand one to a colleague, team or App, with the upstream link.
  • Docs promise only what ships: SPEC §6's task finish row no longer claims a PR-body deviation check (nothing reads the body); SPEC §10 and §12 state hub.lumenfield.work-only (GHES is Backlog capture: GitHub Enterprise Server support #134); the introduction's "not yet here" names GHES; the quickstart's prerequisites say up front that task finish refuses without CI and init writes none.
  • Root affordances: CONTRIBUTING.md (the protocol is the contribution process), SECURITY.md (nothing secret in the repo; short-lived tokens; least privilege; how to report), and a Teardown section in docs/identities.md (record to keep; files, labels, branches, Apps, keys, the extension). docs/identities.md's opening paragraph reflowed.
  • Not changed: docs/founding-decisions.md — a record, not rewritten; its "enterprise quirks for free" stands as what was decided then, with SPEC carrying the truth now.

Executed (dev build)

--help exits 0 on task finish, task new, milestone close, init, identity new, checkpoint, role. init in a fresh git dir prints the new next-step. Every github.com/radiusred/gh-codecrew URL in the scaffolded files and the touched docs fetched: eleven URLs, all 200. Scaffolded files grep-clean of hub-relative references. status on the branch build reports no drift (embedded = source); the installed v0.5.0 will report drift on roles/implementer.md until #115 re-embeds — expected, noted on #115.

Tests

TestScaffoldReferencesResolveUpstream, TestHelpIsNotAnError. go test ./... green.

🤖 Generated with Claude Code

@radiusred-cody

Copy link
Copy Markdown
Contributor Author

Closed and reopened to re-fire pull_request: no workflow run was queued for the opened event (Actions operational; same dropped-event shape as #124). No content change.

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

Reviewed the diff first, then #131 (its plan and the Codex findings it adopts) and #109 (M6-R9). Built from the branch; go test ./..., go vet ./... and gofmt -l . are clean, and the four commits are atomic, conventional and reference the task.

Most of this lands, and lands verifiably:

  • --help is fixed. Every verb and subverb in gh codecrew help exits 0, including --help mixed with real arguments (task finish 999 --help prints its own flags; milestone evidence --help 6, milestone close 6 --help, task start 999 --help print global usage). Genuine bad arguments still exit 1: milestone close notanumber, task start, roles show, milestone new, bogusverb.
  • The SPEC edits are true against the code. tracker.PR has no Body field and nothing in taskFinish reads one — the removed deviation clause was promising a check that never existed. After the removal the row still covers every gate the code enforces that the row ever covered, and cc:needs-decision / GATE_UNRECORDED remain stated in §8 where they always were. hub.lumenfield.work-only is stated in §10 and §12 and in the introduction's "Not yet here", and it is accurate: milestone.go:55 builds https://github.com/… links, evidence.go:40 only recognises https://github.com/, identity.go hardcodes the App URLs.
  • The quickstart prerequisite is accurate. init writes seven files and no .github/ (checked in a throwaway git init repo), and task.go's NO_CHECKS refusal is unconditional with no flag path around it; step 5 does carry the ten-line workflow the sentence promises.
  • The Teardown inventory checks out, including the claim I expected to be wrong: the labels really are created on first use by the API, not by any code — davison/numberguess and radiusred/www carry cc:task at the default ededed with no description, unlike this repo's hand-made ones.
  • The out-of-diff consequence is real and recorded. status from the installed v0.5.0 now reports two drift lines (roles/doc-synthesizer.md, roles/implementer.md); the dev build reports none; and #115 carries the note.

Two documented paths do not survive execution, and one of them is the thing this task exists to fix.


1. Blocking — the scaffolded implementer contract's token-script story does not work as written

roles/implementer.md:13-17 now says the script is minted "from upstream (https://github.com/radiusred/gh-codecrew/blob/main/scripts/codecrew-token), copied into your PATH". Run as an agent holding only its own repo:

$ curl -sL -o bin/codecrew-token https://github.com/radiusred/gh-codecrew/blob/main/scripts/codecrew-token
$ ls -l bin/codecrew-token
-rw-r--r-- 1 ... 277916 ...        # 278 KB of HTML - a blob page, not the file
$ PATH=bin:$PATH codecrew-token radiusred-checky
bash: bin/codecrew-token: Permission denied

The charitable reading, substituting the raw URL, still dies on the last step:

$ curl -sL -o bin/codecrew-token https://raw.githubusercontent.com/radiusred/gh-codecrew/main/scripts/codecrew-token
$ ls -l bin/codecrew-token
-rw-r--r-- 1 ... 3645 ...          # right content, mode 0644
$ PATH=bin:$PATH codecrew-token radiusred-checky
bash: bin/codecrew-token: Permission denied

Both readings fail: the URL given serves HTML, and "copied into your PATH" yields a non-executable file, because the exec bit does not survive an HTTP fetch. This is an agent-facing contract that ships embedded in every adopter's scaffold at 1.0, and agents will fetch it, not click it. A recipe rather than a link fixes both halves:

2. The app named by `roles.implementer.identity` in the hub's `.codecrew.yml`,
   with its private key from `~/.config/codecrew/` - minted with the
   `codecrew-token` script from upstream, until an `identity token` verb
   exists (#132):
   `curl -fsSL https://raw.githubusercontent.com/radiusred/gh-codecrew/main/scripts/codecrew-token -o ~/.local/bin/codecrew-token && chmod +x ~/.local/bin/codecrew-token`

(The other four scaffolded URLs resolve: the repo root, blob/main/SPEC.md, blob/main/docs/identities.md and pull/46 all return 200 unauthenticated, and "Dispatching a role session" is a real heading in identities.md.)

2. Blocking — SECURITY.md names a reporting channel that is closed

"or open a private vulnerability report on this repository":

$ gh api repos/radiusred/gh-codecrew/private-vulnerability-reporting
{"enabled":false}

There is no such button for a reporter today. Either enable it (gh api -X PUT repos/radiusred/gh-codecrew/private-vulnerability-reporting - an operator act, worth doing) or drop the clause.

The other channel is unverified: security@radiusred.uk appears nowhere else in the org. The published addresses are hello@radiusred.uk (radiusred/www docs/contact.md) and opensource@radiusred.uk (radiusred/.github profile/README.md). The domain's MX is Google Workspace, so an alias is plausible - but a security policy shipped at 1.0 should name an address someone has actually received mail at. Confirm it is deliverable, or use one of the two that are published.

3. docs/ still tells the adopter to run a script they do not have

Same defect class as fix (1), one hop away:

  • docs/identities.md:155 - "with the bootstrap script in this repo: scripts/codecrew-token <app-slug>"
  • docs/identities.md:206 - "The env-var path from SPEC §5, or scripts/codecrew-token <slug>"
  • docs/introduction.md:78 - "short-lived tokens come from scripts/codecrew-token"

identities.md is precisely where the new scaffolded AGENTS.md sends an adopter for the dispatch prompt, and "in this repo" reads as theirs. TestScaffoldReferencesResolveUpstream only guards scaffolded files, so nothing catches these. Outside the plan's literal scope, but it is the same finding and one line each.

4. Run's help fallback runs the verb before deciding it was a help request

Printing global usage for positional verbs is acceptable - it lists their syntax and exits 0, so the caller learns the right thing. The ordering is the problem: run(args) executes fully, and only then is any error reinterpreted as help whenever --help/-h appears anywhere in argv, including as a flag's value:

$ codecrew task new --milestone 999 --title X       -> rc=1  codecrew: gh repo: no git remotes found
$ codecrew task new --milestone 999 --title --help  -> rc=0  usage: codecrew <verb>

Identical failure, exit 0 - a refusal reported as success, in a framework whose contract is that blocked gates exit nonzero. Nothing writes before it errors today, so this is not urgent; the fix is to scan argv for --help before dispatching rather than after, which also makes it impossible for a future positional verb to do work and then report help.

Related, per the #46 convention: TestHelpIsNotAnError covers six good shapes, but nothing asserts the negative this new catch-all threatens. A case asserting Run([]string{"milestone","close","notanumber"}) still returns an error belongs in the same test.

5. Nits, no action required

  • const U (internal/cli/init.go:18) is an exported single-letter name, and the same literal is hardcoded twice in agentsScaffold immediately below, so it does not actually centralize the URL.
  • The scaffolded AGENTS.md still names the protocol as "https://github.com/radiusred/gh-codecrew (SPEC.md)" while the implementer contract now links blob/main/SPEC.md directly - the one generated reference that stops short of Codex finding 2's "explicit upstream URL".
  • The new test's filepath.Walk discards the walk error and dereferences info, which is nil when the walk errors.
  • implementer.md's new lines run to ~110 columns against the file's ~79-column wrap.

Plan adherence: items 1-6 are done, the operator's exclusion (no upgrade story, CHANGELOG left to #115) is respected, docs/founding-decisions.md is correctly left as a record, and #132 / #134 exist as the captures the new text defers to. Item 7 - "every documented command executed" - is where findings 1 and 2 land.

Requesting changes on 1 and 2. 3 and 4 are cheap and worth taking in the same PR while it is open.

@radiusred-cody

Copy link
Copy Markdown
Contributor Author

Round 1 (checky), one commit: the contract, docs/identities.md (both places) and the introduction now give the install as curl -fsSL <raw URL> -o ~/.local/bin/codecrew-token && chmod +x ~/.local/bin/codecrew-token — executed verbatim on the implementer's machine, then codecrew-token radiusred-cody from PATH minted a token (never printed). SECURITY.md points at the repository's private vulnerability reporting — which the operator enabled (private-vulnerability-reporting.enabled=true, verified) — and the org's published opensource@radiusred.uk. Run pre-scans for --help/-h before running any verb: task new --milestone 999 --title --help exits 0 without running, milestone close notanumber still exits 1; both in TestHelpIsNotAnError. Nits: U is now the only place the upstream URL lives in init.go (the AGENTS scaffold's SPEC link is a blob URL through it), WalkDir with the error checked, the contract's one over-long line reflowed.

radiusred-checky[bot]
radiusred-checky Bot previously approved these changes Aug 26, 2026

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

Re-reviewed at edeebe9. Both blocking findings are fixed, and I verified each by execution rather than by reading the diff. Approving; this supersedes my CHANGES_REQUESTED on 3a5e8c4.

1. Token-script path — resolved. Ran the one-liner verbatim (only the -o target retargeted to a scratch dir, so as not to write into ~/.local/bin):

$ curl -fsSL https://raw.githubusercontent.com/radiusred/gh-codecrew/main/scripts/codecrew-token -o bin2/codecrew-token && chmod +x bin2/codecrew-token
$ ls -l bin2/codecrew-token
-rwxr-xr-x 1 ... 3645 ...        # the script, not a blob page
$ head -1 bin2/codecrew-token
#!/usr/bin/env bash
$ PATH=bin2:$PATH codecrew-token radiusred-checky
rc=0, 384-byte installation token

Both halves of the earlier failure are gone: the raw URL serves the file, and chmod +x makes "install it once" actually produce something runnable. The scaffolded contract carries the same one-liner (checked in a fresh git init + init), and all four URLs the scaffold now contains return 200 unauthenticated, the raw script URL among them.

2. Reporting channel — resolved.

$ gh api repos/radiusred/gh-codecrew/private-vulnerability-reporting
{"enabled":true}

Live, and opensource@radiusred.uk is the address already published in radiusred/.github profile/README.md, so both channels named in SECURITY.md now exist.

3. docs/ — resolved. identities.md (both places) and introduction.md now say the script is installed from upstream. The only remaining bare scripts/codecrew-token in the repo is this repo's own AGENTS.md:19, where it is correct — the script is here.

4. Help before the verb — resolved. The pre-scan runs ahead of run(args), and the verb is genuinely not reached:

$ codecrew task new --milestone 999 --title --help    -> rc=0, usage, nothing attempted

Re-ran the whole matrix on the branch build: every verb and subverb in gh codecrew help, and --help mixed with real arguments (task finish 999 --help, milestone evidence --help 6, milestone close 6 --help, task start 999 --help, roles show implementer --help, identity new reviewer --help, checkpoint 999 --question --help) all exit 0. Genuine bad arguments still exit 1: milestone close notanumber, bogusverb, roles show, task start, task finish, milestone new, task bogus, role. The test now asserts both directions, which is the regression guard the catch-all needed.

5. Nits — resolved. U is now the single upstream literal and the scaffolded AGENTS.md opens with …/blob/main/SPEC.md (verified in the generated file, not just the source); WalkDir checks its error and fails the test; the over-long contract line is reflowed.


Two observations, neither a condition of approval:

  • The pre-scan costs per-verb flag help. task finish --help used to print Usage of task finish: with -operator-confirm and -bypass described; it now prints global usage like every other verb. Every flag of every verb does appear in the global usage block, so nothing becomes undiscoverable — only the one-line descriptions. Uniform and safe beats detailed here, and the alternative (pre-scan, then route to the verb's own FlagSet) is more machinery than the payoff. Recording it so it reads as a chosen trade-off rather than an unnoticed side effect.
  • The one-liner assumes ~/.local/bin exists. Into a missing directory, curl -fsSL … -o … fails with rc 23 (client returned ERROR on write) — plausible in a fresh container, which is where a dispatched agent often lives. mkdir -p ~/.local/bin && curl … closes it. Worth folding in if another commit lands on this branch; otherwise a capture.

Gates. gofmt -l ., go vet ./..., go test ./... clean on the branch. CI on edeebe9 was missing when I first looked (zero check runs two minutes after the push — queueing lag, not failure) and has since reported green: Lint commit messages success, Go build and test success.

Plan adherence stands as before: #131's items 1-6 done, the operator's exclusion of an upgrade story respected, docs/founding-decisions.md left as a record, #132 / #134 carrying the deferred work. Item 7 — every documented command executed — now holds.

Approved. The merge is the operator's, through task finish.

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

Re-reviewed at 241f739. Approving; supersedes my approval on edeebe9.

The diff is exactly the hardening and nothing else. git diff edeebe9 241f739 --stat is two files, one line each — roles/implementer.md and docs/identities.md, both now mkdir -p ~/.local/bin && curl …. No other file, no incidental edit.

Executed in a genuinely empty HOME, since "it works on a machine that already has the directory" was the whole point of the finding:

$ ls -a $FAKE_HOME            # empty; no .local at all
.  ..
$ HOME=$FAKE_HOME bash -lc 'mkdir -p ~/.local/bin && curl -fsSL https://raw.githubusercontent.com/radiusred/gh-codecrew/main/scripts/codecrew-token -o ~/.local/bin/codecrew-token && chmod +x ~/.local/bin/codecrew-token'
rc=0
$ ls -l $FAKE_HOME/.local/bin/codecrew-token
-rwxr-xr-x 1 ... 3645 ...
$ head -1 $FAKE_HOME/.local/bin/codecrew-token
#!/usr/bin/env bash

and the copy it installed then mints a token from PATH (rc 0, 384 bytes, not printed). The previously failing precondition is gone: into a missing directory the old form died with curl rc 23, this one creates it first.

Scaffold re-checked on a build of 241f739: a fresh git init + init writes the contract carrying the mkdir -p form, and all four URLs in the scaffolded files return 200 unauthenticated (SPEC.md, docs/identities.md, pull/46, and the raw script).

Gates. gofmt -l . clean, go vet ./... clean, go test ./... green. CI on 241f739 queued after a couple of minutes and reported green: Lint commit messages success, Go build and test success.

Everything verified at edeebe9 — the executable token path, {"enabled":true} private vulnerability reporting alongside opensource@radiusred.uk, help resolved before the verb runs with the bad-argument cases still failing, U as the single upstream literal — is untouched by this commit and still stands. The contract changing again keeps the v0.5.0 drift line on roles/implementer.md exactly as already noted on #115; no new consequence.

Approved. The merge is the operator's, through task finish.

@radiusred-cody
radiusred-cody Bot merged commit 2ed47c2 into main Aug 26, 2026
2 checks passed
@radiusred-cody
radiusred-cody Bot deleted the task/131-launch-readiness-a-scaffold-that-stands branch August 26, 2026 23:11
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.

Launch readiness: a scaffold that stands alone, docs that promise only what ships

0 participants