Skip to content

feat(claimant): record primary-clone branch+commit in every fire log entry (#12813) - #13008

Merged
dezren39 merged 1 commit into
mainfrom
lane-if/12813-fire-log-code-source
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-if/12813-fire-log-code-source

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

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 every fires.jsonl entry as code_source, mirroring the claimant mode file: guard the silent-deletion single point of failure #10332 mode_source pattern.
  • test_claimant.py: TestCodeSourceFireLog — branch/commit read from a real temp clone, fail-open on a non-repo path, and a fire entry carrying code_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 aborted cap_unknown and 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_claimant suite 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.


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

…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).
@coderabbitai

coderabbitai Bot commented Nov 23, 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 58 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: 590be0f8-7564-45a9-a0c2-94ef19c96fe2
Commits

Reviewing files that changed from the base of the PR and between 8eb8916 and 09bf549.

Files selected for processing: 2

  • 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 23, 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-23T06:59:04.878257Z 09bf549 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.

@dezren39
dezren39 merged commit 3ca4644 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-if/12813-fire-log-code-source branch November 23, 2026 06:57

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment on lines +1609 to +1613
subprocess.run(
["git", "init", "-b", "main", str(clone)],
check=True,
capture_output=True,
env=env,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

opencode-claimant: all live fires abort at cap since primary clone left on xaltha branch (cap_unknown, nothing launches)

1 participant