Skip to content

refactor(cli): one session turn runner for every face #428

Closed

Description

@ajianaz

Problem

"Run one turn for a session" is implemented six times — run_command, resume_command, chat_command (main.rs), run_mission (mission.rs), run_session_turn and resume_session_turn (session_host.rs) — and each copy implements a different subset:

concern run resume chat mission serve / ACP
durable fact/model override (#176) ✗ ✗ ✗ ✗ ✓
cancel token / wall-clock timeout ✓ ✗ ✗ ✗ ✓
sibling watcher (#380) ✓ ✗ ✗ ✗ ✗
memory recall / remember ✓ – ✓ refused copied
missing-config message copy copy copy copy broken string (embedded run of spaces)

So a session whose model was switched in ACP silently runs on the env model when resumed with tole resume / tole chat --resume, and new turn features have to land in three or more places (#377, #380, #209).

Plan (small PRs)

  1. Session provider: one function builds the provider for a session turn — env config with one missing-config message, the session's fact/model override, tool specs, pinned system prompt, optional live-token sinks. All six sites use it (fixes the model override on CLI faces and the broken message).
  2. Memory in/out: one place for pre-turn recall injection and post-turn remember.
  3. Cancel + watcher: resume and chat get a cancel token (and the child sibling watcher), so the CLI faces settle as Cancelled like run does.

Third item of the 2026-10-26 architecture review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementharness

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions