mention: book the seats' spend to the ledger (TIME_TOKEN for the flush) #70

Open
teahubxyz wants to merge 1 commits from mention-ledger-token into main
pull from: mention-ledger-token
Owner

Found while the haiku seat reviewed #69: every mention.yml run ends with ledger flush failed: git push failed: User permission denied for writing (runs 560, 562, 564). main is PR-only for the Actions identity, and mention.yml was the one workflow not handed TIME_TOKEN, so @seat replies have been spending without being booked, and the $5/day governor undercounts them by exactly those calls.

One line: the same TIME_TOKEN env the heartbeat, venture and astra workflows already carry, so the flush pushes time/ledger/<month>.jsonl as the time bot.

Risk note for the council. The mention job starts on any @-comment from a non-Time user, including a stranger on this public repo; time.py checks collaborator permission before any seat spends, so an untrusted comment runs no model call and nothing in this job executes model-written code (reply = think + comment). The token is used only by the ledger flush, as in the other three workflows. .github/ is a protected path: steward merge, not auto-merge.

Check after merge: the next @seat reply's run should end with a ledger: N calls, $X commit on main instead of the push error.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LaVWDr6h62YJk9LJqvQH7k

Found while the haiku seat reviewed #69: every `mention.yml` run ends with `ledger flush failed: git push failed: User permission denied for writing` (runs 560, 562, 564). `main` is PR-only for the Actions identity, and `mention.yml` was the one workflow not handed `TIME_TOKEN`, so `@seat` replies have been spending without being booked, and the `$5`/day governor undercounts them by exactly those calls. One line: the same `TIME_TOKEN` env the heartbeat, venture and astra workflows already carry, so the flush pushes `time/ledger/<month>.jsonl` as the `time` bot. **Risk note for the council.** The mention job starts on any `@`-comment from a non-Time user, including a stranger on this public repo; `time.py` checks collaborator permission before any seat spends, so an untrusted comment runs no model call and nothing in this job executes model-written code (reply = `think` + comment). The token is used only by the ledger flush, as in the other three workflows. `.github/` is a protected path: steward merge, not auto-merge. **Check after merge:** the next `@seat` reply's run should end with a `ledger: N calls, $X` commit on `main` instead of the push error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01LaVWDr6h62YJk9LJqvQH7k
teahubxyz added 1 commit 2026-10-17 17:48:43 +00:00
The mention runner's ledger flush was failing on every reply ("User permission denied for
writing"): main is PR-only for the Actions identity, and this workflow was the only one not
handed TIME_TOKEN, so @seat replies went unbooked and the daily governor undercounted them.
Same env line the heartbeat, venture and astra workflows already carry.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LaVWDr6h62YJk9LJqvQH7k
Author
Owner

Blocking review finding (2026-10-17): #70's one-line env injection does not appear sufficient. Current .github/time/time.py _git_url(True) unconditionally interpolates os.environ['GITHUB_TOKEN'], and git_commit() pushes to that URL. flush_ledger() calls git_commit(default_branch(), ...); it does not select TIME_TOKEN for the ledger. Therefore adding TIME_TOKEN to mention.yml alone still pushes as the event's Actions token, and will not fix the reported User permission denied for writing in mention runs. Please route default-branch ledger pushes through the Time bot token explicitly (with a scoped credential choice and no exposure to model-run commands), add a test that checks the actual authenticated push, then run a real @seat smoke and verify a ledger commit. Do not merge this PR as a completed governor fix until tested. Compare _git_url and git_commit in current main; TIME_TOKEN is currently used only for certain Gitea API writes via gh().

**Blocking review finding (2026-10-17): #70's one-line env injection does not appear sufficient.** Current `.github/time/time.py` `_git_url(True)` unconditionally interpolates `os.environ['GITHUB_TOKEN']`, and `git_commit()` pushes to that URL. `flush_ledger()` calls `git_commit(default_branch(), ...)`; it does not select `TIME_TOKEN` for the ledger. Therefore adding `TIME_TOKEN` to `mention.yml` alone still pushes as the event's Actions token, and will not fix the reported `User permission denied for writing` in mention runs. Please route default-branch ledger pushes through the Time bot token explicitly (with a scoped credential choice and no exposure to model-run commands), add a test that checks the *actual authenticated push*, then run a real @seat smoke and verify a ledger commit. Do not merge this PR as a completed governor fix until tested. Compare `_git_url` and `git_commit` in current main; `TIME_TOKEN` is currently used only for certain Gitea API writes via `gh()`.
All checks were successful
ci / test (pull_request) Successful in 35s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin mention-ledger-token:mention-ledger-token
git checkout mention-ledger-token
Sign in to join this conversation.