Repository navigation
Conversation
Step 2.2 of #9016: the Queue/GitHub sync verbs. Eight typed shadow verbs (gh_sync.rs) declare their whole command line, validate it strictly (#3352), and rewrite to the canonical gh call before the close guard, closure layer and metadata create path run — inheriting the step-1 token rotation, the retry-safety rule, value-free errors and the audit trail. Callers retired onto the verbs: - opencode-claimant/claimant.py: the label read (sync-labels) and the three agent-note posts, deduplicated into one helper over sync-comment. - opencode-claimant/launch_one.py: the hard-stop read (sync-view) and the launch note post (sync-comment --body-file). - pm-stack/dispatch github.ts: the whole gh fallback route now runs sync-label-ensure / sync-issue-create / sync-issue-get / sync-labels-add / sync-issue-close / sync-comment through the packaged fleet binary. The verb close speaks the fleet closure taxonomy (#9221): dispatch's not_planned maps to cancelled, completed to implemented. Registry help inventory and pkgs/fleet/docs/verbs.md updated in the same change. The #9016 job-body flows (program tending, stewardship verdicts, pool reviews) compose the same two caller operations — comment posts and label/state reads — and adopt these verbs from their own bodies, which live outside this repo.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d142839be8
ℹ️ 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".
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; |
There was a problem hiding this comment.
Add property-based coverage for the sync parser invariants
The new parser has meaningful invariants—undeclared arguments must be refused, supported argument forms must rewrite equivalently, and non-sync calls must pass through unchanged—but its test module contains only example-based tests and names no test oracles. Root AGENTS.md explicitly requires property tests where code has invariants and requires every automated test to name its oracle. Add generated coverage for these parser invariants with an explicit oracle; the existing examples can remain as acceptance coverage.
AGENTS.md reference: AGENTS.md:L34-L39
Useful? React with 👍 / 👎.
| "sync-issue-close" => { | ||
| let p = parse_declared(verb, tail, &["--repo", "--reason"])?; |
There was a problem hiding this comment.
Allow a successor when closing an issue as superseded
For sync-issue-close --reason superseded, this parser accepts the reason because it belongs to gh_closure::REASONS, but the subsequent gh_closure::parse call rejects it because superseded closures require --successor. The sync verb neither declares that option nor forwards it, so there is no successful invocation for this advertised closure reason. Accept and forward --successor, including the downstream requirement that it be present for superseded closures.
Useful? React with 👍 / 👎.
| let sync_rewrite; | ||
| let args: &[String] = match gh_sync::parse(args) { |
There was a problem hiding this comment.
Preserve migrated reads under the raw-mode environment
When a claimant or dispatch process inherits FLEET_GH_RAW=1, the early return in gh::run at lines 1485–1488 executes before this rewrite and forwards sync-* arguments unchanged to the real gh binary. Raw mode is a documented identity-pinning escape hatch (doc/fleet/gh-credential-lifecycle.md:204–213), and checking gh sync-labels --help confirms the result: unknown command "sync-labels" for "gh". Previously the migrated callers supplied ordinary issue/pr commands that worked in that environment; now their label/state reads fail, causing the claimant's fail-closed checks to prevent launches. Account for the sync translation when handling inherited raw mode.
Useful? React with 👍 / 👎.
| /** The packaged fleet binary the fallback's sync verbs run through: | ||
| * PM_DISPATCH_FLEET_BIN overrides; the default is the packaged | ||
| * location the opencode claimant also uses (~/.local/bin/fleet). */ | ||
| const FLEET_BIN = process.env.PM_DISPATCH_FLEET_BIN ?? join(homedir(), ".local", "bin", "fleet"); |
There was a problem hiding this comment.
Include fleet in the packaged dispatch runtime
For a Nix-managed dispatch deployment without an imperative fleet installation, this default points to a binary the package does not provide. pkgs/pm-dispatch/package.nix:56–66 still supplies only gh and git, and nixos/services/pm-stack/default.nix:356 launches that package directly without configuring PM_DISPATCH_FLEET_BIN. Repository-wide searches found no declarative installation of ~/.local/bin/fleet. Consequently, when App credentials are absent or the App route fails, the previously packaged gh fallback now fails to spawn instead of performing the GitHub operation. Include fleet in the runtime dependency closure and configure its packaged path.
Useful? React with 👍 / 👎.
| "--body".into(), | ||
| body, |
There was a problem hiding this comment.
Preserve file transport for large comment bodies
On Linux, sync-comment --body-file now moves the entire file into a single --body argument, so bodies exceeding the per-argument size limit prevent gh from starting with E2BIG. For example, 45,000 CJK characters occupy 135,000 UTF-8 bytes; a local subprocess reproduction confirmed that passing this text as an argument fails while passing its file path succeeds. This loses the file transport supported by the replaced command (gh issue comment --help: “Read body text from file”). Preserve --body-file after validating readability, or pass the contents through stdin, rather than placing them in argv.
Useful? React with 👍 / 👎.
Step 2.2 of #9016 — the Queue/GitHub sync verbs. Refs #10973.
What landed
Eight typed
fleet gh sync-*shadow verbs (new modulepkgs/fleet/crates/fleet/src/gh_sync.rs): each declares its whole command line, validates it strictly (the #3352 contract — undeclared arguments are usage errors), and rewrites to the canonical gh call. The rewrite is applied ingh::runbefore the close guard, the closure layer and the metadata create path parse the arguments, so a sync call inherits the step-1 token rotation, the retry-safety rule, value-free errors and the audit trail exactly as the hand-written passthrough call it replaces — and the caller's stdout contract stays gh's own output, byte-exact.sync-labels --repo R <issue|pr> N<kind> view N --json labels --jq [.labels[].name]sync-view --repo R <issue|pr> N<kind> view N --json labels,state,titlesync-comment --repo R <issue|pr> N --body T | --body-file P<kind> comment N --body T(file read by the verb layer; unreadable file refuses before any write)sync-issue-create --repo R --title T --body … [--label L]…issue create …(metadata stamping applies downstream)sync-issue-get --repo R Napi repos/R/issues/Nsync-labels-add --repo R N --label L…issue edit N --add-label L…sync-label-ensure --repo R --label L --color C --description Dlabel create L --force …sync-issue-close --repo R N --reason <fleet reason>issue close N --reason <fleet reason>(closure layer appends the reason comment + record)Registry help inventory (
fleet-registry) andpkgs/fleet/docs/verbs.mdupdated in the same change.Caller evidence
sync-labels(same fail-closed contract, test(pm-stack/claimant): test/test_claimant.py Slice-1 suite run by no workflow and broken against the live claimant API — 4/4 error, held-label pin has no live counterpart #7670); the three agent-note posts (launch / hand-back / stuck-holder) were deduplicated into one helper oversync-comment. No rawghcomposition remains in the file.sync-view; the launch note post runssync-comment --body-file(it already staged the note to a file). Its callers in send_to_opencode.py inherit both.PM_DISPATCH_FLEET_BIN, default~/.local/bin/fleet, the claimant's packaged location): ensureLabel →sync-label-ensure, createIssue →sync-issue-create, getIssue →sync-issue-get, addLabels →sync-labels-add, closeIssue →sync-issue-close, comment →sync-comment. The pm-stack App REST route stays primary and untouched. Disclosure: the verb close speaks the fleet closure taxonomy (fleet gh: closure records + reason-required closes (audit trail by construction) #9221), so dispatch'snot_plannedmaps tocancelledandcompletedtoimplemented; GitHub's ownstate_reasongranularity is not preserved. Every live caller closes withnot_planned, compensating a dispatch-created tracking issue whose launch failed (launch_failure.ts).Overlap with step 2.1 (#10972)
Built independently from main, per the sequencing: no dependency on the 2.1 branch. Both steps need strict verb parsing; here it lives inside gh_sync.rs as a small declared-flags parser. If 2.1 lands its own, factoring a shared helper is a small follow-up either way.
Verification (remote dispatch, per the current build rule)
Submitted via
fleet queue dispatchagainst this branch; at PR time all three are still queued for placement (the fleet's GitHub-hosted surfaces are saturated and the placer's load reads are erroring tonight — the jobs are recorded and will run):cargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet -p fleet-registry— handlefp_783d9b73c28e881223ebd1dfe0ea78ddpython3 pm-stack/opencode-claimant/run_hermetic_tests.py— handlefp_371f0a95ed7d942259d32c7671ad4696cd pm-stack/dispatch && bun install --frozen-lockfile && bun test test/github.test.ts && bunx tsc --noEmit— handlefp_3fdf5efaa63319c5f8a237075227666aRun ids/URLs and outcomes will be appended on #10973 as they land. This PR's own CI also covers the caller suites (pm-stack-tests.yml runs the dispatch bun suite and the claimant Python suites) and the fleet Rust crates. Locally, only a Python syntax parse of the edited files was run — no suites were compiled or run in the sandbox or on the laptop.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.