Skip to content

Record refusals before launch in the review ledger, with a reason code - #33

Merged
razbenaharon merged 1 commit into
mainfrom
feature/ledger-refusals
Nov 22, 2026
Merged

razbenaharon merged 1 commit into
mainfrom
feature/ledger-refusals

Conversation

@razbenaharon

Copy link
Copy Markdown
Owner

Summary

A call that ModelQuad refused before Codex started left no row in the review ledger, so modelquad review report could count stopped calls but not say why they were stopped. Each such refusal is now recorded with its closed reason code, and the report lists the stopped calls by reason.

  • Ledger schema 4. runs gains a reason column. A schema 3 ledger is migrated in place and keeps its rows; rows written before this change show as not recorded. Only a closed code ([a-z0-9_]{1,64}) is stored, never free text.
  • The refusal comes first. The write does not wait for a locked ledger and never changes the refusal. When it cannot be written, the reply says so (ledger_note), and the MCP reply shows that note on refusals too.
  • Two refusals stay unrecorded on purpose: a worker's (invariant 1) and an unusable project path, so those paths still touch nothing.
  • Report. A Reasons: line under "Stopped before Codex started".
  • Docs that had drifted. Docstrings in review_reminder.py and netpolicy.py now match the code. AGENTS.md states that the cross-process run lock falls back to the in-process rule when its lock file cannot be opened; that is existing behaviour, now written down. PRIVACY.md and CHANGELOG.md are updated.

No linked issue.

Notes for the reviewer:

  • A build older than this one refuses to read a ledger once it is at schema 4, as with earlier schema bumps.
  • AGENTS.md now says schema 4 while the version stays 0.5.3; the entry is under ## Unreleased in the changelog.
  • The duplicate-run block in review.run() was restructured so the ledger write happens outside the running lock.

Tests run

  • python scripts/check.py fast (as part of review)
  • python scripts/check.py review: 1878 passed, 7 skipped
  • New or changed behaviour has tests

Not run locally: the whole suite (python scripts/check.py python); CI runs it. One blank line inside a docstring in netpolicy.py was removed after the test run. Not exercised against a real ledger, only the suite's temporary state.

Windows version: Windows 11

AI assistance

Yes. OpenAI Codex wrote the code and tests from a brief; Claude Code planned the change, reviewed the whole diff, ran the checks above, and wrote the commit message and this description.

Checklist

  • Every commit of mine is signed off (git commit -s), as described in CONTRIBUTING.md (DCO 1.1). The maintainer's own commits need none. (Maintainer's commit; no sign-off.)
  • The change does not weaken the safety invariants in AGENTS.md.
  • A new host or provider was agreed in an issue first, or this change adds none.
  • Documentation is updated, and describes only what the code does today.

🤖 Generated with Claude Code

A call that ModelQuad refused before Codex started left no trace, so the
report could not say why calls were stopped. Each such refusal is now
written to the ledger with its closed reason code, and the report lists
the stopped calls by reason.

- Ledger schema 4: `runs` gains a `reason` column; a schema 3 ledger is
  migrated in place. Only a closed code is stored, never free text.
- The write never waits for a locked ledger and never changes the
  refusal; when it fails, the reply says so (`ledger_note`).
- Worker refusals and unusable project paths are not recorded, so those
  paths still touch nothing.
- Docstrings in `review_reminder.py` and `netpolicy.py` now match the
  code, and AGENTS.md states that the cross-process run lock falls back
  to the in-process rule when its file cannot be opened.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@razbenaharon
razbenaharon merged commit 069a678 into main Nov 22, 2026
7 checks passed
@razbenaharon
razbenaharon deleted the feature/ledger-refusals branch November 22, 2026 15:51
@razbenaharon razbenaharon mentioned this pull request Nov 24, 2026
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.

1 participant