Skip to content

inbox: an unreadable inbox is one MAILBOX_ERROR line and exit 5; the loops report it once and drop the mailbox (#98) - #157

Merged
deanbot merged 2 commits into
mainfrom
98-inbox-read-error
Nov 2, 2026
Merged

deanbot merged 2 commits into
mainfrom
98-inbox-read-error

Conversation

@deanbot

@deanbot deanbot commented Nov 2, 2026

Copy link
Copy Markdown
Owner

What changed and why

inbox.mjs --dir <inbox> reads a loop's inbox every cycle. When the folder couldn't be read (ENOTDIR: the path is a file or lies under one; EACCES: no read permission), it threw, printed a stack trace and exited 1, on every cycle. No loop said what that meant, so a session could retry forever or read the failure as "no messages". --check refuses such paths at the start; this covers a folder that goes bad after the check.

  • scripts/inbox.mjs. Before any read or wait, --wait included, it tries the folder once. If the folder exists but can't be read, it prints one line, MAILBOX_ERROR: <inbox>: <code>, and exits 5, with no stack trace. Exit 1 is a usage error, and 3 and 4 are the waiter's (WATCHER_RUNNING, a takeover). An inbox that doesn't exist is still NONE.
  • Claude Code executor, reviewer and QA (the Messages section). On MAILBOX_ERROR, report it once: ⚠ Mailbox off: <the line>; running without it. in the status line and the same line to the outbox. Then run without the mailbox for the rest of the session: no step 0, and no --inbox on any waiter. The read is never retried each cycle.
  • SPEC's Inbox folder section names the line, the exit code and the loop's rule.

Done, and the checks that show it

All in scripts/test/run.mjs, inbox section, tests named inbox (#98): ….

  • One line naming the inbox and the error code, a distinct non-zero exit, no stack trace:

    • an inbox under a file gives MAILBOX_ERROR: <inbox>: ENOTDIR and exit 5;
    • a path naming a file gives the same;
    • with --wait, the same line and exit 5 at once, with no wait;
    • an unreadable folder (mode 000) gives EACCES and exit 5. Root can read any folder, so under root this case checks only the exit.

    Each of these checks there are no at … frames and no Error:.

  • The skills say what to do on the line: a text test checks that every Claude Code loop reports it once (status line and outbox) and then runs without the mailbox, never retrying. Generic and Kiro read no inbox: their start check always prints NO_MAILBOX, so the line can't reach them.

  • The spec names the line and the exit code: SPEC, "A folder that goes bad after the start".

  • Contract tests: the four script cases above. Also, a missing inbox is still NONE with exit 0.

Mutation-checked: removing the new folder check fails all four MAILBOX_ERROR cases.

Calls a reviewer might push back on

  • Exit 5. The issue asks for a code distinct from the waiter's. Exit 4 is already the waiter's takeover.
  • The line goes to stdout, where the loop reads its signal lines, and not to stderr.
  • The check runs once at the start of each run. A folder that goes bad in the middle of a --wait is a failed pass, and the waiter logs it and retries as for any other. The loops run --dir one-shot each cycle, so the next cycle gets the line.
  • The code alone, not the system message. The message repeats the path and adds nothing a reader acts on.

Restart note

All three Claude Code roles (executor, reviewer, QA) need a fresh session to pick up the text. Generic and Kiro: none. Setup doesn't need re-running.

Closes #98

…tack trace; the loops report it once and drop the mailbox (#98)
@deanbot
deanbot marked this pull request as ready for review November 2, 2026 03:36
@deanbot
deanbot merged commit 91ba0de into main Nov 2, 2026
4 checks passed
@deanbot
deanbot deleted the 98-inbox-read-error branch November 2, 2026 03:49
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.

inbox.mjs --dir crashes with a stack trace on an unreadable inbox, and no skill says what a failed --dir means

1 participant