Skip to content

fix: a lease commit spammed the pull request's timeline - #20

Merged
MarketDataApp merged 2 commits into
mainfrom
fix/lease-commit-cross-references
Sep 22, 2026
Merged

MarketDataApp merged 2 commits into
mainfrom
fix/lease-commit-cross-references

Conversation

@MarketDataApp

Copy link
Copy Markdown
Contributor

Reported from a phone screenshot of MarketData-App/api#463: the timeline is full of marketdata-code-review[bot] referenced this in MarketData-App/code-review-credentials, each showing a lease taken by MarketData… / lease freed by MarketData… commit.

Cause

holder is <owner>/<repo>#<pr>#<run>-<attempt>, and <owner>/<repo>#<pr> is exactly GitHub's cross-repository issue reference syntax. It went into the lease commit message verbatim, so every write to codex/lease.json posted a cross-reference onto the reviewed pull request.

Two events per review, on every review, for the life of the branch.

Measured on api#463 — twelve lease commits, twelve timeline events, matching to the second:

Timeline event Lease commit
2026-09-22T14:25:26Z 14:25:25 lease taken by MarketData-App/api#463#35740179424-1
2026-09-22T14:26:06Z 14:26:05 lease freed by MarketData-App/api#463#35740179424-1
… 10 more … …

Its timeline holds 12 referenced events against 2 committed, 2 commented and 3 labeled.

Fix

lease_message spells the same three facts without the #:

lease taken by MarketData-App/api pull 463 run 35743856939-1

The holder is untouched. release compares it to decide whether this run still owns the lease, and that identity is why it carries the run id and attempt — rewriting it would reopen the race #<run_id>-<run_attempt> was added to close. Only the human-facing message changes.

lease_spans now reads both forms and keys a hold on (repo, pr, run) rather than on the message's spelling, so the months of #-joined history already in the store keep parsing. Verified against the live store: 237 holds over 7 days, unchanged.

What this does not do

It cannot retire the events already posted. GitHub builds a cross-reference from the commit and offers no way to delete one. The existing noise on open pull requests stays; no new noise is added.

Tests

11 new, TDD, each watched failing first. 653 passed, ruff clean. One test round-trips lease_message through lease_spans, so a change to either side without the other fails here rather than in next week's report.

`holder` is `<owner>/<repo>#<pr>#<run>-<attempt>`, and `<owner>/<repo>#<pr>`
is exactly GitHub's cross-repository issue reference syntax. It went into the
lease commit message verbatim, so every borrow and every return posted a
"referenced this in code-review-credentials" event onto the reviewed pull
request's own timeline.

Two events per review, on every review, for the life of the branch. Measured
2026-09-22 on MarketData-App/api#463: twelve lease commits, twelve timeline
events, timestamps matching to the second. That pull request's timeline holds
more lease references than commits, comments and labels combined.

`lease_message` now spells the same three facts without the `#`:

    lease taken by MarketData-App/api pull 463 run 35743856939-1

The HOLDER is untouched. `release` compares it to decide whether this run
still owns the lease, and that identity is the whole reason it carries the
run id and attempt; rewriting it would reopen the race it was added to close.
Only the human-facing message changes.

`lease_spans` reads both forms and keys a hold on (repo, pr, run) rather than
on the message's spelling, so the months of `#`-joined history already in the
store keep parsing and `lease-report` is unaffected.

This cannot retire the timeline events already posted. GitHub builds a
cross-reference from the commit and offers no way to delete one.
@marketdata-code-review

marketdata-code-review Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

✅ Ready — Code review

This change removes GitHub cross-repository references from lease commit messages while preserving the stored holder identity. The history parser supports both old and new message formats and normalizes them to the same lease span identity.

Rating patch 5/6 (solid) · proof 6/6 (comprehensive) · overall 5/6

Findings

Nit

  • reviewbot/credentials.py:120-129 Move dated incident narrative out of code (style, 1c4d475a)
    The new docstring embeds a dated incident report and measurements that belong in the pull request or commit history. The cited house-style examples do not override the standing rule for newly added comments; retain only the enduring constraint that raw holders create cross-references.

    reviewbot/credentials.py:120-129 — Measured 2026-09-22 on MarketData-App/api#463: twelve lease commits, twelve timeline events, timestamps matching to the second.

Since last review

  • Resolved: a1f9e042, 2f9d3e2b
  • 0 still open, 1 new

Reviewed fb444cd · revision 2 · codex (gpt-5.6-sol) · claude unavailable · rules: default

a1f9e042 from the bot's review of this pull request.

A new-format span took the bare repository token as its `holder`
("MarketData-App/api"), and an open span with no pull request was given a
fabricated "verification#None#". So the field's meaning depended both on
which message wrote the hold and on whether it had been freed.

The holder is now rebuilt once, beside the pairing key, and carried through
the open-span map. Old and new formats yield the identical string, an open
hold reads the same as a closed one, and a holder with no pull request stays
"verification" rather than being padded. One test round-trips every shape
through `lease_message` and back.

2f9d3e2b (nit) Not taken, for the third time and the same reason: dated
measurements in docstrings are this repository's house style, present in
credentials.py, github.py, claude.py and cli.py.
@MarketDataApp

Copy link
Copy Markdown
Contributor Author

a1f9e042 — correct. Fixed.

The holder is now rebuilt once, beside the pairing key, and carried through the open-span map, so both branches append the same string. Old and new formats yield an identical holder, an open hold reads the same as a closed one, and a holder with no pull request stays verification rather than being padded to verification#None#. One test round-trips every shape through lease_message and back.

2f9d3e2b — not taken, same as 8ebd1bc4 and ad392b16 on #19. Dated measurements in docstrings are this repository's house style, not an exception to it: credentials.py:10, backends/claude.py:25, github.py:303, github.py:361, cli.py:42. The date is what makes the claim checkable later, and here the measurement is the evidence that the bug was real — twelve commits, twelve timeline events, matching to the second.

This is the third review running to raise it. If the rule is wanted, it belongs in REVIEW.md where it would apply to the existing instances too; as a per-pull-request nit it just asks new code to differ from the code around it.

@MarketDataApp
MarketDataApp merged commit cf5f2a4 into main Sep 22, 2026
2 checks passed
@MarketDataApp
MarketDataApp deleted the fix/lease-commit-cross-references branch September 22, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant