Repository navigation
feat(claimant): record primary-clone branch+commit in every fire log entry (#12813) - #13008
Conversation
…entry (#12813) The 2026-11-23 cap_unknown incident was the primary clone silently sitting on a stale branch; the fire log named neither branch nor commit, so the cause had to be reconstructed from the reflog. log_fire now threads a code_source record (path, state, branch, commit) into every fires.jsonl entry, mirroring the #10332 mode_source pattern. read_code_source() is fail-open: any git failure yields state "unreadable" with null branch/commit and never aborts a fire. Cached per process (one fire = one process). Tests: TestCodeSourceFireLog (branch/commit read from a real temp clone, fail-open on a non-repo, fire entry carries code_source).
|
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 58 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: 09bf5491c6
ℹ️ 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".
| subprocess.run( | ||
| ["git", "init", "-b", "main", str(clone)], | ||
| check=True, | ||
| capture_output=True, | ||
| env=env, |
There was a problem hiding this comment.
Keep Git subprocesses out of the hermetic test suite
Running the supported make test entry point now fails: run_hermetic_tests.py loads this test class after installing an audit hook that rejects every subprocess.Popen. Both tests using _make_clone() therefore raise before creating their repositories. The unreadable-clone test also attempts real Git subprocesses; although read_code_source() catches the exception, the harness records the violation and still exits unsuccessfully. Mock the Git calls in the hermetic suite, or separate real-repository integration coverage into an explicitly permitted runner.
Useful? React with 👍 / 👎.
For #12813 (remediation item 2): the claimant fire log now names the code it ran.
Change (
pm-stack/opencode-claimant/, +143, insertions only):claimant.py:read_code_source()reads the primary clone's checked-out branch + commit via git, cached per process, fail-open (any git failure →state: "unreadable", null branch/commit, never aborts a fire).log_fire()threads the record into everyfires.jsonlentry ascode_source, mirroring the claimant mode file: guard the silent-deletion single point of failure #10332mode_sourcepattern.test_claimant.py:TestCodeSourceFireLog— branch/commit read from a real temp clone, fail-open on a non-repo path, and a fire entry carryingcode_source.Why: the 2026-11-23 incident was the primary clone sitting on
xaltha/12751-read-authority, whose poll.py predated the #12225 paging fix; every fire abortedcap_unknownand the log named neither branch nor commit — the cause had to be reconstructed from the clone's reflog. With this, the first fire on wrong code names itself.Verification: new tests 3/3; the fire-log classes (TestMainFireLog, TestCapUnknownFireLog, TestGateUnknownFireLog, TestGateExitFireLog, TestSingleInstanceLock) + new class: 10 ran, OK. Full
test_claimantsuite is slow under current laptop load (individual tests run real timeout behaviour); the touched surface is the fire-log path, covered above.Does not close #12813 — the incident reconciliation is recorded on the issue; the remaining question (pin the claimant's ref vs. rely on this provenance) stays open there.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.