Repository navigation
Session modes: keep-warm vs fresh-per-message, plus a Fresh-session operator action - #168
Merged
xmiksay merged 1 commit intoJul 13, 2026
Conversation
…) + Fresh session action What: add a per-project session_mode (keep_warm default, fresh_per_message) plus a "Fresh session" operator action available in any mode. Why: context accumulation is usually right, but sometimes the operator wants a clean slate — on demand when a session goes down a wrong path, or as a per-project policy when every trigger should be judged fresh (#165). How: tasks.session_id stays the single resume key (populated -> claude -r, null -> fresh session), so no tasks schema change. New projects.session_mode column + src/project/mode.rs (SessionMode enum, update_session_mode). confirm_task resolves it into resume_session_id (resolve_resume_session_id, unit-tested); fresh mode always spawns null. The turn loop skips warm-idle parking in fresh mode (drain-or-close immediately), so a fresh session never holds an admission slot between turns. jobs::control::continue_task and the new fresh_session generalize into restart_task(task_id, clear_session), sharing the existing CAS guard (#159 H2). New route POST /api/tasks/{id}/fresh_session and PUT /api/projects/{id}/session_mode; SPA gets a Session mode card on ProjectDetail and a Fresh session button on TaskDetail. Split src/jobs/runner.rs's stdio wiring into src/jobs/session_io.rs to make room for the session_mode threading without crossing the 400-line cap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session_mode(keep_warmdefault,fresh_per_message):keep_warmis today's behavior (resume/warm-idle viaclaude -r);fresh_per_messageruns every trigger in a brand-new claude session and never stays warm between turns.POST /api/tasks/{id}/fresh_session) available in any mode: clearssession_idand restarts the task so the next turn starts a new claude session in the same worktree. Refuses while a live agent is attached or the task ispending; works even when no session was ever captured.jobs::control::continue_taskandfresh_sessionnow share arestart_task(task_id, clear_session)core.confirm_taskresolves the owning project's mode intoresume_session_id(resolve_resume_session_id, unit-tested); the turn loop skips warm-idle parking entirely in fresh mode.src/jobs/runner.rs's stdio/channel wiring intosrc/jobs/session_io.rsto make room for the session-mode threading without crossing the 400-line file cap.docs/architecture.md(module map,projectstable, HTTP surface, turn-loop paragraph),.claude/CLAUDE.md/.env.example/README.mdnoteWARM_IDLE_TIMEOUT_SECSiskeep_warm-only.Test plan
cargo check --all-targets,cargo clippy --all-targets -- -D warnings,cargo fmt --checkall cleancargo testagainst both SQLite and a live Postgres (make testequivalent) — 265 lib tests + all integration tests pass on both backends, including newproject::mode,jobs::store::resolve_resume_session_id_matrix, andjobs::lifecycle::fresh_session_*testsnpm run typecheckandnpm run test(102 frontend tests) passCloses #165