Skip to content

opencode-claimant: hand back the next candidate on cap saturation (#1187) - #12678

Merged
dezren39 merged 1 commit into
mainfrom
felix/1187-dispatch-slice
Nov 22, 2026
Merged

dezren39 merged 1 commit into
mainfrom
felix/1187-dispatch-slice

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

One slice of #1187 (OpenChamber dispatch v1.1): hand-backs as code in the opencode claimant — criterion 2's mechanism.

Component status map for #1187, reconciled against origin/main for this slice:

Component State
Admission control Capacity half landed: the claimant's cap step (36 root sessions, pm-stack/opencode-claimant, #3026) admits launches. Pool half is route-owned: launches go on opencode-route/workhorse and the route owns pool selection/failover; no dispatcher-side POOL MAP gate exists as code.
Hand-backs This PR. Was prose-only (conductor instruction; the conductor cron is disabled) over broker storage that already supported it (capacity ready-condition, #3418/#8184).
Stall nudges Not landed as code — babysitter/conductor prose only, never fired. Next slice.
Harvesting Landed and verified operationally (criteria 1 & 5 verified 2026-11-01: the dispatched set all reached terminal queue states with PR evidence).
Workhorse-first routing Landed: #1272 (routing policy alignment, closed); the claimant launches on the workhorse route by default. Criterion 4's Frontier ledger remains a standing check — no Frontier sessions yet.

What changed: a live claimant fire that finds the session cap saturated with launchable candidates waiting now hands the next candidate back in the same fire — targeted-claims it (the broker's park verb only parks a task its caller holds), parks it with reason class executor-saturated and the broker's capacity ready-condition ({"kind": "capacity"}), and posts the hand-back agent-note on its issue. Before this PR the same fire wrote only a local fires.jsonl skip record and exited, leaving the candidate silently queued — the backlog shape the issue forbids ("Saturation is reported, never a silent backlog").

One hand-back per fire; shadow fires mutate nothing; a claim that does not land (or lands on a different row) parks nothing. The fire log keeps its cap_saturated skip entry and records the hand-back under a new hand_back key (the provider_wall precedent). No new dependencies.

Evidence

Fail-before (on origin/main, new tests only): python3 -m unittest test_claimant.TestHandBackStep → 6 tests, 1 failure + 5 errors (no hand_back_step, no hand-back in a saturated fire).

Pass-after (this branch, commit 6239d2a87): the claimant's full hermetic suite —

$ python3 -I run_hermetic_tests.py   # pm-stack/opencode-claimant
Ran 165 tests in 0.060s
OK

including the 6 new TestHandBackStep tests (oracle: the argv sequence at the subprocess boundary — claim --task for the first candidate only, one park carrying executor-saturated + the capacity ready-condition, one gh issue comment — plus the fires.jsonl entry) and the pre-existing cap-exit fire-log test, which gains the subprocess stub it now needs to stay hermetic (its assertions are unchanged).

Venue: the suite is hermetic by design (offline, fail-closed I/O guards, all transports stubbed) and ran in the sandbox; no live queue, server, or GitHub state was touched. The live behaviour closes criterion 2's standing check on the first saturated claimant fire that exercises it — per the 2026-11-03 ruling (option B), criteria 2–3 are natural-occurrence standing checks, so the issue's checkbox stays unticked until that occurrence.

Merge Danger

Low. The change is additive inside one step of one script: a new branch in the saturated path of a claimant fire, three new helpers, one new optional log_fire key. The only behavioural change for existing paths is that a live saturated fire now performs one claim + one park + one issue comment it did not before; shadow mode is byte-identical in behaviour, and every failure mode of the new step degrades to a recorded non-hand-back (the fire still exits 0 with the cap_saturated skip). Reverting this PR restores the prose-only status quo without touching queue state shape — the capacity ready-condition it writes is the broker's existing, already-shipped wait kind.


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

)

A live claimant fire that found the session cap saturated only
wrote a local fires.jsonl skip record and exited: the waiting
candidates stayed queued with nothing on the task or its issue -
the silent backlog dispatch v1.1 forbids. The hand-back existed
only as prose in the (now disabled) conductor instruction.

hand_back_step now runs in the saturated branch of a fire: it
targeted-claims the next launchable candidate from the fire-start
snapshot, parks it with reason class executor-saturated and the
broker's capacity ready-condition (a capacity wait - floored at
the capacity scale, budget-bypass eligible when a slot frees),
and posts the hand-back agent-note on the candidate's issue.
One hand-back per fire; shadow fires mutate nothing; a claim
that does not land parks nothing. The fire log records the
outcome under its own hand_back key, keeping the cap_saturated
skip entry unchanged.

Tests: TestHandBackStep (6) over the argv boundary plus the
fires entry; the existing cap-exit fire-log test gains the
subprocess stub it now needs to stay hermetic. Full hermetic
suite: 165 tests OK.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 80c99957-e316-47ff-aa4f-208cf4d6f199
Commits

Reviewing files that changed from the base of the PR and between 37d678b and 6239d2a.

Files selected for processing: 3

  • pm-stack/opencode-claimant/README.md
  • pm-stack/opencode-claimant/claimant.py
  • pm-stack/opencode-claimant/test_claimant.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T20:53:19.931723Z 6239d2a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant