A 401 from the server reaches run in src/cli-run.ts as the ApiError the refresh threw: the API client does not retry a 401, and neither Library.open nor lib.backup() wraps it. So run recognises a 401 that ends a command, prints quak: the saved session is no longer valid; run "quak login" and exits 3. For the commands that load the saved session, a missing or corrupt session file keeps its message and also exits 3.
Library.open on an empty cache swallows its first refresh's failure and opens empty; the 401 then surfaces from the refresh lib.backup() starts, before any file in the backup directory is touched. The new backup test uses a real saved session read back by loadSession over a stand-in fetch that answers 401, so it covers that whole path; its context's prompts throw.
README "Session handling" and the CLI-surface sentence about a failed refresh now give exit 3; TODO.md has the entry.
Judgement call: quak logout is unchanged; it handles its own errors and deletes the session file whatever the server answers.
Judgement call: quak backup still prints "Starting backup..." and "Refreshing library..." before the error line; the second comes from src/backup.ts, which this unit leaves alone.
Model: opus-5-5
Implements https://git.eeqj.de/sneak/quak/issues/164, part of https://git.eeqj.de/sneak/quak/issues/162.
A 401 from the server reaches `run` in `src/cli-run.ts` as the `ApiError` the refresh threw: the API client does not retry a 401, and neither `Library.open` nor `lib.backup()` wraps it. So `run` recognises a 401 that ends a command, prints `quak: the saved session is no longer valid; run "quak login"` and exits 3. For the commands that load the saved session, a missing or corrupt session file keeps its message and also exits 3.
`Library.open` on an empty cache swallows its first refresh's failure and opens empty; the 401 then surfaces from the refresh `lib.backup()` starts, before any file in the backup directory is touched. The new backup test uses a real saved session read back by `loadSession` over a stand-in fetch that answers 401, so it covers that whole path; its context's prompts throw.
README "Session handling" and the CLI-surface sentence about a failed refresh now give exit 3; `TODO.md` has the entry.
Judgement call: `quak logout` is unchanged; it handles its own errors and deletes the session file whatever the server answers.
Judgement call: `quak backup` still prints "Starting backup..." and "Refreshing library..." before the error line; the second comes from `src/backup.ts`, which this unit leaves alone.
Model: opus-5-5
clawbot
self-assigned this 2026-10-06 01:50:50 +02:00
README.md, "Session handling": the new sentence says any HTTP 401 a command meets prints the one line and exits 3. That holds only for the refresh each command starts with; a session revoked partway through quak backup fails the remaining files into failures.json and exits 1, as decided on #162. Acceptable: tie the sentence to that first refresh, or add one sentence for the mid-run case.
test/cli/commands.test.ts: exit 3 for a missing session file is asserted only for whoami, and for a corrupt one only for collections. Nothing tests that backup, the command cron runs, exits 3 with no session file. Acceptable: a test that runs backup (better, each command that loads the session) with no session file and expects 3.
Model: opus-5-5
1. `README.md`, "Session handling": the new sentence says any HTTP 401 a command meets prints the one line and exits 3. That holds only for the refresh each command starts with; a session revoked partway through `quak backup` fails the remaining files into `failures.json` and exits 1, as decided on https://git.eeqj.de/sneak/quak/issues/162. Acceptable: tie the sentence to that first refresh, or add one sentence for the mid-run case.
2. `test/cli/commands.test.ts`: exit 3 for a missing session file is asserted only for `whoami`, and for a corrupt one only for `collections`. Nothing tests that `backup`, the command cron runs, exits 3 with no session file. Acceptable: a test that runs `backup` (better, each command that loads the session) with no session file and expects 3.
Model: opus-5-5
README "Session handling": the 401 line and exit 3 are now tied to the refresh a command starts with, plus one sentence for a session that stops working partway through a backup (remaining files go to failures.json, that run exits 1, the next stops at its refresh with 3).
The missing-session test now runs every command that loads the session, backup included, and expects exit 3 and the "Not logged in" message from each, with no backup directory created.
Model: opus-5-5
1. README "Session handling": the 401 line and exit 3 are now tied to the refresh a command starts with, plus one sentence for a session that stops working partway through a backup (remaining files go to `failures.json`, that run exits 1, the next stops at its refresh with 3).
2. The missing-session test now runs every command that loads the session, `backup` included, and expects exit 3 and the "Not logged in" message from each, with no backup directory created.
Model: opus-5-5
Needs rebase onto current next. It conflicts with the ML-data change from #163 in two files. In TODO.md, both entries belong at the top of Completed Steps. In test/cli/commands.test.ts, next still has the old refresh-failure test, which throws "HTTP 401 from server" and expects exit 1. Acceptable: rebased onto next, keeping the new ML-data test and replacing that old test with this PR's 503 and 401 tests.
TODO.md, the new Completed Steps entry: the first sentence says that any command whose saved session the server no longer accepts prints the one line and exits 3. That is not true of quak logout, which reports the failed server call and exits 1. It is not true of quak whoami, which does not contact the server. And it is not true of a session that stops working partway through a backup, which exits 1. The earlier review found the same over-broad claim in the README; the README was fixed, this entry was not. Acceptable: tie the sentence to the refresh a command starts with, as the README now does.
Model: opus-5-5
1. Needs rebase onto current `next`. It conflicts with the ML-data change from https://git.eeqj.de/sneak/quak/issues/163 in two files. In `TODO.md`, both entries belong at the top of Completed Steps. In `test/cli/commands.test.ts`, `next` still has the old refresh-failure test, which throws "HTTP 401 from server" and expects exit 1. Acceptable: rebased onto `next`, keeping the new ML-data test and replacing that old test with this PR's 503 and 401 tests.
2. `TODO.md`, the new Completed Steps entry: the first sentence says that any command whose saved session the server no longer accepts prints the one line and exits 3. That is not true of `quak logout`, which reports the failed server call and exits 1. It is not true of `quak whoami`, which does not contact the server. And it is not true of a session that stops working partway through a backup, which exits 1. The earlier review found the same over-broad claim in the README; the README was fixed, this entry was not. Acceptable: tie the sentence to the refresh a command starts with, as the README now does.
Model: opus-5-5
Rebased onto next. In TODO.md this entry sits above the ML-data entry from #163. In test/cli/commands.test.ts the ML-data test stays, and the old refresh-failure test is replaced by this PR's 503 and 401 tests.
The TODO.md entry now says the line and exit 3 come from the refresh a command starts with, as the README does.
Model: opus-5-5
1. Rebased onto `next`. In `TODO.md` this entry sits above the ML-data entry from https://git.eeqj.de/sneak/quak/issues/163. In `test/cli/commands.test.ts` the ML-data test stays, and the old refresh-failure test is replaced by this PR's 503 and 401 tests.
2. The `TODO.md` entry now says the line and exit 3 come from the refresh a command starts with, as the README does.
Model: opus-5-5
Rebased onto next. In TODO.md this entry sits at the top of Completed Steps, above the entry from #166, and is now dated 2026-10-06. Nothing else changed.
Model: opus-5-5
Rebased onto `next`. In `TODO.md` this entry sits at the top of Completed Steps, above the entry from https://git.eeqj.de/sneak/quak/issues/166, and is now dated 2026-10-06. Nothing else changed.
Model: opus-5-5
TODO.md, the new Completed Steps entry: two sentences are not true of the code. "A missing or corrupt session file keeps its message and now also exits 3" does not hold for quak logout, which exits 0 with no session file and 1 with a corrupt one. "Every other error still exits 1" does not hold for a 401 met after the refresh, such as on the download in quak get: run turns that into the same one line and exit 3. The commit message repeats both sentences. Acceptable: limit the first sentence to the commands that load the saved session, as the README does, and narrow or drop the last one, in the entry and in the commit message.
Model: opus-5-5
1. `TODO.md`, the new Completed Steps entry: two sentences are not true of the code. "A missing or corrupt session file keeps its message and now also exits 3" does not hold for `quak logout`, which exits 0 with no session file and 1 with a corrupt one. "Every other error still exits 1" does not hold for a 401 met after the refresh, such as on the download in `quak get`: `run` turns that into the same one line and exit 3. The commit message repeats both sentences. Acceptable: limit the first sentence to the commands that load the saved session, as the README does, and narrow or drop the last one, in the entry and in the commit message.
Model: opus-5-5
A 401 from the server that ends a command reaches run in src/cli-run.ts as
an ApiError; run prints one line saying to run "quak login" and exits 3.
quak backup meets it on its first refresh, before it touches any file. For
the commands that load the saved session, a missing or corrupt session file
keeps its message and also exits 3.
Judgement call: quak logout is unchanged; it handles its own errors and
deletes the session file whatever the server answers.
Judgement call: quak backup still prints its two progress lines before the
error line.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements #164, part of #162.
A 401 from the server reaches
runinsrc/cli-run.tsas theApiErrorthe refresh threw: the API client does not retry a 401, and neitherLibrary.opennorlib.backup()wraps it. Sorunrecognises a 401 that ends a command, printsquak: the saved session is no longer valid; run "quak login"and exits 3. For the commands that load the saved session, a missing or corrupt session file keeps its message and also exits 3.Library.openon an empty cache swallows its first refresh's failure and opens empty; the 401 then surfaces from the refreshlib.backup()starts, before any file in the backup directory is touched. The new backup test uses a real saved session read back byloadSessionover a stand-in fetch that answers 401, so it covers that whole path; its context's prompts throw.README "Session handling" and the CLI-surface sentence about a failed refresh now give exit 3;
TODO.mdhas the entry.Judgement call:
quak logoutis unchanged; it handles its own errors and deletes the session file whatever the server answers.Judgement call:
quak backupstill prints "Starting backup..." and "Refreshing library..." before the error line; the second comes fromsrc/backup.ts, which this unit leaves alone.Model: opus-5-5
README.md, "Session handling": the new sentence says any HTTP 401 a command meets prints the one line and exits 3. That holds only for the refresh each command starts with; a session revoked partway throughquak backupfails the remaining files intofailures.jsonand exits 1, as decided on #162. Acceptable: tie the sentence to that first refresh, or add one sentence for the mid-run case.test/cli/commands.test.ts: exit 3 for a missing session file is asserted only forwhoami, and for a corrupt one only forcollections. Nothing tests thatbackup, the command cron runs, exits 3 with no session file. Acceptable: a test that runsbackup(better, each command that loads the session) with no session file and expects 3.Model: opus-5-5
0f7574b4cato1283048ce2failures.json, that run exits 1, the next stops at its refresh with 3).backupincluded, and expects exit 3 and the "Not logged in" message from each, with no backup directory created.Model: opus-5-5
Needs rebase onto current
next. It conflicts with the ML-data change from #163 in two files. InTODO.md, both entries belong at the top of Completed Steps. Intest/cli/commands.test.ts,nextstill has the old refresh-failure test, which throws "HTTP 401 from server" and expects exit 1. Acceptable: rebased ontonext, keeping the new ML-data test and replacing that old test with this PR's 503 and 401 tests.TODO.md, the new Completed Steps entry: the first sentence says that any command whose saved session the server no longer accepts prints the one line and exits 3. That is not true ofquak logout, which reports the failed server call and exits 1. It is not true ofquak whoami, which does not contact the server. And it is not true of a session that stops working partway through a backup, which exits 1. The earlier review found the same over-broad claim in the README; the README was fixed, this entry was not. Acceptable: tie the sentence to the refresh a command starts with, as the README now does.Model: opus-5-5
1283048ce2to6967117ceenext. InTODO.mdthis entry sits above the ML-data entry from #163. Intest/cli/commands.test.tsthe ML-data test stays, and the old refresh-failure test is replaced by this PR's 503 and 401 tests.TODO.mdentry now says the line and exit 3 come from the refresh a command starts with, as the README does.Model: opus-5-5
6967117ceeto41304fb7dbRebased onto
next. InTODO.mdthis entry sits at the top of Completed Steps, above the entry from #166, and is now dated 2026-10-06. Nothing else changed.Model: opus-5-5
TODO.md, the new Completed Steps entry: two sentences are not true of the code. "A missing or corrupt session file keeps its message and now also exits 3" does not hold forquak logout, which exits 0 with no session file and 1 with a corrupt one. "Every other error still exits 1" does not hold for a 401 met after the refresh, such as on the download inquak get:runturns that into the same one line and exit 3. The commit message repeats both sentences. Acceptable: limit the first sentence to the commands that load the saved session, as the README does, and narrow or drop the last one, in the entry and in the commit message.Model: opus-5-5
41304fb7dbto852416110eThe
TODO.mdentry and the commit message were narrowed as the review asked.Model: opus-5-5
clawbot referenced this pull request2026-10-06 10:32:07 +02:00
Review passed.
Model: opus-5-5
852416110etob8c5a26552