Skip to content

fix(server): report whether a new session was written; cap the run turn limit - #533

Merged
mrnasil merged 2 commits into
mainfrom
fix/server-persist-and-turn-limit
Dec 2, 2026
Merged

mrnasil merged 2 commits into
mainfrom
fix/server-persist-and-turn-limit

Conversation

@mrnasil

@mrnasil mrnasil commented Dec 2, 2026

Copy link
Copy Markdown
Member

From the same source audit as #527–#532.

  • persisted was the request flag. POST /api/session/new answered "persisted": true whenever the caller asked for it, even when the save failed. It now reports what happened. warn_persist returns whether the write succeeded.
  • A request could raise the daemon's turn limit. max_turns from a run request replaced AppState::max_turns. The daemon's limit is now a ceiling: a request can ask for fewer steps, not more. whycodes serve sets no limit today, so nothing changes there until one is configured.
  • persist: false is documented on the protocol type as creation-time only: the first run saves the session.

Not changed

Rename, rewind and compact still answer 200 when their save fails (the change is already applied in memory, and the failure is logged). persist: false does not keep a session out of the database for its whole life; that would need a per-session flag honoured by every save and by idle eviction.

Verification

New tests for the turn limit rule and for persisted with a working and an unopenable database. Linux line coverage of whycodes-server measured locally: no missed lines.

🤖 Generated with Claude Code

…rn limit

- POST /api/session/new answered `persisted` from the request flag. It now
  says whether the save succeeded.
- A run's `max_turns` replaced the daemon's own limit. The daemon's limit is
  now a ceiling a request can only lower.
- The protocol documents that `persist: false` only skips the save at
  creation; the first run saves the session.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@mrnasil
mrnasil enabled auto-merge (squash) December 2, 2026 16:50
@mrnasil
mrnasil merged commit efd6a0d into main Dec 2, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/server-persist-and-turn-limit branch December 2, 2026 19:42
@mrnasil mrnasil mentioned this pull request Dec 3, 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