Repository navigation
fix(issue-radar): render the ledger read-back traceback to text, not exc_info - #12943
Conversation
…exc_info Both read-back helpers in crew_store.py (_landed_since, _all_landed) hold a CrewLog handle from open_session_log and logged with exc_info=True, which the exc_info-sites guard refuses because the record's traceback would pin the handle's lease under a record-keeping handler. Route both through crew_log.store.log_exception_text.
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify CI's [DESIGN-REVIEWED] d6165b7 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Guard's green is the only proof this contract can't read — confirm What this change shipsInventory (3 items) — 3 justifiedIntent: turn the guard test on
Evidence: the pin [FIRST-PRINCIPLES-REVIEWED] d6165b7 |
…exc_info (kirodotdev#12943) Both read-back helpers in crew_store.py (_landed_since, _all_landed) hold a CrewLog handle from open_session_log and logged with exc_info=True, which the exc_info-sites guard refuses because the record's traceback would pin the handle's lease under a record-keeping handler. Route both through crew_log.store.log_exception_text.
Problem / Motivation
mainis red:test/test_crew_log_exc_info_sites.py::test_no_exc_info_site_anywhere_in_kiro_crew_holds_a_crew_log_handlefails on every shard that carries it (seen first on Backend Tests (Windows) 7 of PR #12776's merge ref), and every open PR inherits the red throughrefs/pull/N/merge.The offenders are two
logger.debug(..., exc_info=True)calls insrc/kiro_crew/apps/builtins/issue_radar/backend/crew_store.py(_landed_sinceand_all_landed), both landed by #12303. Each sits in a frame that holds aCrewLoghandle obtained fromprojection.open_session_log(...).Why it matters
The guard exists because an
exc_infotriple on a log record keeps the traceback, the traceback keeps the frame, and the frame keeps theCrewLoghandle -- whose write lease is only released by a finalizer when the handle is dropped. A record-keeping handler (pytest'scaplog, aMemoryHandler) then keeps the lease alive for as long as it keeps the record. That is the order-dependent lease flake the guard turned deterministic. Left as is, the ledger read-back path can pin a session log's lease, and the whole repository's CI stays red.What changed (motivation -> approach -> change)
Symptom: guard test red on
main. Root cause: two newexc_info=Truesites inside handle-holding frames. Change: both sites now callkiro_crew.crew_log.store.log_exception_text, the package's helper for exactly this frame shape -- it renderstraceback.format_exc()to text behindisEnabledFor(level), so the record carries a string and no frame. Same message, sameDEBUGlevel, sameattemptargument; only the traceback's carrier changes. The import is top-level, next to the existingkiro_crew.crew_log.entry_typesimport (crew_log.storeimports nothing fromapps, so there is no cycle).Backwards compatibility
Compatible: log message text and level are unchanged; only the traceback moves from the record's
exc_infoto the rendered message body.Tests
No new tests: the existing guard
test_no_exc_info_site_anywhere_in_kiro_crew_holds_a_crew_log_handleis the regression test and flips red -> green with this change (it names both sites at_landed_sinceand_all_landedbefore, none after).Run on native Windows (Python 3.12.10) against this branch's
src:test/test_crew_log_exc_info_sites.py test/test_issue_radar_crew_store.py test/test_issue_radar_crew_runtime.py src/kiro_crew/apps/builtins/issue_radar/tests-> 1351 passed, 2 skipped, 0 failed.Manual verification
N/A -- unit coverage sufficient: the guard test is a whole-tree AST walk, and the behavioural tests of the ledger read-back paths (
_landed_since/_all_landed) are in the crew store suite above.Related Issues
Follow-up to #12303. Unblocks the inherited red on #12776 and every other open PR.
Pattern harvest
Rule candidate: review-prompt
Pattern:
exc_info=Trueinside a function whose frame binds aCrewLoghandle (including one returned byopen_session_log) -- already enforced by the AST guard; the review prompt should point a PR that adds a log-reading helper atstore.log_exception_textbefore CI has to.Checklist
crew_store.pystays in.github/black-baseline.txt; black's only requested hunk is the pre-existingNAME_POOLblock, not these lines)