Skip to content

fix(loop): the journal pointer is an optimisation, not a precondition - #76

Merged
Ardnived merged 1 commit into
mainfrom
claude/journal-degrades
Sep 8, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/journal-degrades

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Follow-on to #75, same class of bug, found by the next live dispatch on claude-workflow#72:

POST https://api.github.com/repos/sydevs/claude-workflow/issues
403  Resource not accessible by personal access token

The dispatcher creates the day's journal issue so it can name it in the record, and it does that before the fire. So one missing token permission stopped the work again — the board fix from #75 held, and the run died one step later.

The fix

  • ensureJournalDay never throws. It returns { number: 0, failed } when it cannot list or create.
  • payload.mjs accepts journal.issue: 0 and reports journalKnown: false.
  • handler-journal treats 0 as "find or create today's issue yourself" — the path the nightly survey already takes with no record at all — and journals the fact under 🧭 Friction.
  • postAnomaly and refreshTally no-op on 0 instead of posting to issue zero.
  • docs/why.md#the-journal-pointer-is-an-optimisation, which states the general rule: the fire is the work, everything else is bookkeeping, and bookkeeping that fails should be visible without being fatal.
  • Tests: the degraded create path, the no-op anomaly, and journal.issue 0 vs -1. 55 pass. Rule delta clean.

The token still needs fixing, and it is now the only blocker

Two live dispatches have each found one more thing SYDEVS_BOT_PAT cannot do:

Attempt Result
projectV2(number: 2) null — no organization Projects access
POST /repos/sydevs/claude-workflow/issues 403 Resource not accessible by personal access token

Creating an issue needs Issues: write, which is the same permission every label and comment write needs — so the dispatcher cannot lock an item either, and a session that finds no bot:working label stops on arrival by design. Grant the fine-grained PAT Issues: read and write, Pull requests: read and write, Contents: read and write (the merge needs it), and organization Projects: read and write. claude-workflow is back on BOT_DISPATCH=dry until then.

The second live dispatch died on `POST /repos/.../issues` — 403 while
creating the day's journal issue, before the fire. `ensureJournalDay` now
never throws: it returns 0, `payload.mjs` accepts 0, and handler-journal
finds or creates the day itself, as cron mode already does.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit c438bce into main Sep 8, 2026
2 checks passed
@Ardnived
Ardnived deleted the claude/journal-degrades branch September 8, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant