CHECKPOINT ONLY — not a deliverable, not reviewed, not complete.
Committed by mos-remediation as TRANSPORT after the authoring seat (coder-mos1) became
unable to act: its context window was exceeded at 102.6%/372k AND its overflow-recovery
path failed ("Turn prefix summarization failed: servers overloaded"). The seat could not
process instructions or commit its own work, leaving 28 modified files durable only on
local disk.
Authorship preserved as coder-mos1 — this is transport, not authorship. The work is the
seat's; committing it is the only way to make it survive the rotation that must follow.
Scope note, unresolved: this diff spans the queue-guard tools (9 files under
framework/tools/git) AND 5 framework guides plus 11 agent templates. RM-03 was scoped to
ci-queue-wait.sh and its tests. Whether the doc/template edits are consequential to the
tri-state change or drive-by was queried and never answered — the seat was bricked before
it could reply. That question stays open and must be resolved before any of this is
reviewed; the wider edits may need splitting out.
Direct instance of D-31: commit-then-rotate works, rotate-without-commit loses everything.
5.9 KiB
5.9 KiB
RM-03 — CI Queue Guard Repair
- Task: RM-03
- Issue: #1019
- Branch:
fix/rm-03-queue-guard - Owner: coder-mos1
- Reviewer: rev-974 (independent; author != reviewer)
- Started: 2026-08-01
Objective
Repair the mandatory CI queue guard so it reads provider payloads, blocks asserted non-green CI, distinguishes provider unavailability from a real non-green result, and inspects the branch actually being pushed or merged.
Constraints
- Worktree only:
/home/hermes/agent-work/rm-03; never mutate/src/mosaic-stack. - JSON payload travels through stdin; never argv. Large payload must remain below no ARG_MAX dependency.
- TDD is mandatory. Every behavior case must be observed red before implementation.
- No bypass flags or hook suppression.
- Do not cite the existing guard's green as evidence; D-23 establishes it is zero-information.
- Gate-ready is a frozen exact head. Any push after a merge-gate verdict voids that verdict.
- No merge: coordinator holds the merge hand pending Jason.
Design
- Feed JSON to
python3 -con stdin, including pending-context rendering. - Classify valid green as
READY; pending/failure/no-status/malformed/mixed asASSERTED_NOT_READY; provider/credential/transport inability asCANNOT_ASSERT. ASSERTED_NOT_READYexits nonzero.CANNOT_ASSERTemits a loud diagnostic and appends a local JSONL audit record. Push degrades to exit 0; merge holds with distinct retryable exit 75 until provider recovery, then self-clears without manual reset. Inability to write the audit exits nonzero.- Derive the current branch when
-Bis omitted. The merge wrapper passes the exact PR head branch, repository, and full commit SHA—not itsmainbase—so fork PRs cannot resolve against an adjacent base-repository branch.
Test matrix
| Case | Required outcome |
|---|---|
| success | exit 0; terminal-success |
| pending | nonzero after bounded timeout |
| failure | nonzero |
| no-status | nonzero |
| malformed | nonzero |
| >=150 KiB payload | unchanged classification; never rc126 |
| provider unreachable on push | loud audited CANNOT_ASSERT; degraded exit 0 |
| provider unreachable on merge | loud audited CANNOT_ASSERT; retryable exit 75/HOLD |
| audit unavailable | nonzero |
| implicit push branch | provider URL uses checked-out feature branch |
| merge wrapper | queue guard receives exact PR head branch/repository/full SHA |
RED-first evidence
Observed against the unmodified origin/main implementation before source edits:
bash packages/mosaic/framework/tools/git/test-ci-queue-wait-tristate.sh→ rc 1 with 15 failed assertions.- Success payload was reported
state=unknown. - Pending, failure, no-status, and malformed payloads each exited 0 and omitted
ASSERTED_NOT_READY. - The 160 KiB payload produced rc 141 because Python never consumed the pipe; it did not classify success.
- Provider-unreachable exited 7 with no
CANNOT_ASSERTaudit record. - Implicit push queried
/branches/main, not/branches/fix/rm-03-fixture. - Audit-unavailable emitted no audit diagnostic.
- A credential-resolution hard-block mutant was then run before trusting that added case:
credential-unresolvablereturned rc 1 and omittedCANNOT_ASSERT; the matrix returned rc 1 with two named assertion failures. - Review-blocker controls were observed red: structurally invalid
statusesstring and null-entry payloads each exited 0 asterminal-success; unsupported-platform discovery exited 1 without diagnostic or audit (seven named assertion failures total). - After the push/merge asymmetry ruling, merge-side provider unavailability was observed red at rc 0; its registered case required distinct retryable rc 75.
- Aggregate
state=successwith zero contexts was observed red: it exited 0 asterminal-success; the registered case requiresno-status/nonzero. - Fork/exact-head controls were observed red:
pr-merge.shomitted the fork repository and full SHA, and an ignored-arguments mutant re-resolved through/branches/instead of the exact fork commit (two named failures). - GitHub check-run-only success/pending/failure were each misclassified as
no-status; the RED run had five named failures and proved the Checks API was never queried. - The first merge-pin control was unrunnable because one
localdeclaration referenced a variable before assignment underset -u; this was disclosed and corrected rather than counted. The runnable RED then showed Gitea payload{"Do":"squash"}lackedhead_commit_id; a separate GitHub run showedgh pr merge 123 --squashlacked--match-head-commit. - A stale-verdict mutant removed the
--expect-headcomparison and was observed red because a moved head reached the provider merge call. bash packages/mosaic/framework/tools/git/test-pr-merge-queue-branch.shinitially returned rc 1; captured call was--purpose merge -B main -t 900 -i 15.
Logs remain untracked under the worktree as .mosaic-test-work-red-*.log and will not be committed.
Progress
- Mission, remediation charter, task evidence, board, issue #1019, and superseded PR #1023 read.
- Isolated worktree created and identity configured coherently.
- Mutant tests authored and observed red.
- Implementation green.
- Baseline and situational gates green.
- Independent review clean.
- PR CI terminal-green at exact head by full step scan.
- Merge-gate verdict issued against frozen head.
Risks / boundaries
- The local JSONL audit is durable operational evidence but not tamper-resistant against the same UID. RM-03 does not claim otherwise.
- Push-side audited exit 0 is an explicit owner ruling (Option B), accepted to avoid bricking recovery work; merge-side CANNOT_ASSERT remains retryable exit 75/HOLD. The automated security reviewer continues to flag the deliberate push availability tradeoff.
- Source/deployed-copy equality is owned by RM-02/D-22; this branch changes repository source and its tests only.
Test evidence
Pending.
Final evidence
Pending.