A reply that hit the output-token limit (finish_reason "length") with no tool call — typically thinking consumed the whole budget and nothing else came back — took the `if not turn.tool_calls` branch and ended the turn as "completed". The task was silently abandoned (two of Fable 5.1's three failures and one of Sonnet 5's on a ten-task trial were this shape). Engine: - On such a reply, append a user-role nudge (TRUNCATION_NUDGE: act now, do not repeat the reasoning), emit a CONTINUATION event, and go round the loop. At most MAX_TRUNCATION_CONTINUATIONS (2) consecutive nudges per turn; the counter resets on any non-truncated reply and at the start of each turn. - On the cap, persist a `truncated` notice and end with TURN_END status "truncated" — never "completed". - The cut-off reply stays in the transcript (finish_reason "length", its partial reasoning) but is replayed to providers as a short stub (`replay: "stub"` sidecar → TRUNCATION_STUB): its thinking block has no signature, which Anthropic rejects, and it carries nothing useful anywhere. - A truncated reply that still has a parseable tool call is unchanged (the mangled-call path already covers broken arguments). GUI (surfaces/gui): "continuation" event → info notice; turn_end "truncated" → warning; persisted `truncated` notice replays as a retriable warning; en/zh strings. Tests: tests/test_truncation_continuation.py (nudge then complete, stub replay, partial text, cap → truncated + notice, tool-call case untouched, counter resets within and between turns, normal path untouched, stub survives persistence); GUI itemsFromMessages test for the truncated notice.
coworker GUI (React + Tauri)
A thin client of the coworker server (OpenAI-compatible API + WS event/approval stream). Same codebase runs in a browser (dev) and as the OpenWorker desktop app.
First time: bootstrap the Python backend
A fresh checkout has no server to run — create the venv both flows below expect (from the repo root):
bash packaging/setup_dev_env.sh # → .venv (server + aisuite)
Run it (browser, two terminals)
- Start the server (needs a model key, e.g.
OPENAI_API_KEY, in the environment — or add one later in the app's Settings), from the repo root:./.venv/bin/openworker-server --cwd /path/to/your/project --port 8765 - Start the UI:
cd surfaces/gui npm install # first time npm run dev # → http://localhost:5173
Open http://localhost:5173. The UI talks to http://127.0.0.1:8765 (override with
VITE_COWORKER_HTTP / VITE_COWORKER_WS). Start the server before Vite so the
UI can read its per-launch token from <state-dir>/sidecar-8765.token; restart
Vite if the server is restarted.
Run the desktop app from source
The Tauri shell wraps the same UI and supervises the Python server itself — no separate
terminal. It needs the Rust toolchain (rustup) plus the venv from the bootstrap step;
in dev it finds the server at .venv/bin/openworker-server automatically (a
packaged sidecar binary is only produced by the release scripts in packaging/).
cd surfaces/gui
npm install # first time
npm run tauri dev # builds the shell, launches the window, starts the server
Tests
npx tsc --noEmit && npx vitest run # typecheck + unit
npx playwright test # hermetic e2e (mocked /v1 + WS, no Python needed)