Repository navigation
v0.1.65
v0.1.65
Summary
This release hardens the ACP (Agent Client Protocol) runtime and the agent turn loop:
- ACP reliability overhaul — proper model resolution and API transport selection for
whale-acp, automatic session compaction at a safe threshold, a raised tool-iteration cap,session/listsupport so Zed shows previous sessions, and no more mid-prompt eviction of sessions with in-flight requests. - Agent turn recovery & correctness — the agent now recovers turns that end prematurely before a promised tool call, preserves cancellation causes so service shutdown is not mistaken for a user interrupt, and keeps DeepSeek conversation history ordered for thinking mode.
What's Changed
ACP: model resolution, API transport, auto-compaction & tool cap (#354) — @reneleonhardt
- Model resolution:
WHALE_MODELis validated against supported models at startup (invalid values fail fast) with fallback todeepseek-v4-flash; names are lowercase-canonicalized so a single name feeds both the provider and context-window derivation. The retireddeepseek-chatalias is now rejected. - API transport: new
deepseek.APIsetting (auto | responses | chat_completions) exposed viaWHALE_API(env > config > heuristic);web_search=serverimplies Responses, andchat_completions+ server-side search degrades search tolocalwith a warning instead of refusing to start. Wired through all runtime construction sites, including theweb_fetchextractor. - Auto-compaction: ACP now compacts at an explicit 0.85 threshold with the model-derived context window (1M for V4) — earlier than the agent default 0.90 to avoid the overflow trap.
- Tool iteration cap:
DefaultMaxToolItersraised to 300 (from 100), configurable viaWHALE_MAX_TOOL_ITERS; 0/negative values rejected. - Env knobs:
WHALE_MODEL,WHALE_API,WHALE_COMPACT_THRESHOLD,WHALE_CONTEXT_WINDOW,WHALE_MAX_TOOL_ITERSread once at startup. - Hardening: rejects
NaN/±Infthresholds, honorsweb_search=localon the Responses transport, normalizes whitespace/case inWHALE_API, retries 429s in the web_fetch extractor, and drops a context-compacted event type that could panic the ACP event translator.
ACP: session/list so Zed shows previous sessions (#352) — @reneleonhardt
initializenow advertisessessionCapabilities {list:{}}, so Zed's agent panel can show whale session history.session/listlists persisted sessions from the same storesession/loaduses:sessionId,cwd,title(first visible user message),updatedAt(last message activity, mtime fallback).- Excludes subagent IDs, approval/tool-input event sidecars, and rewrite artifacts; supports the optional
cwdfilter; orders by recency with deterministic tie-breaks.session/deleteremains future work.
ACP: never evict sessions with in-flight prompts (#350) — @reneleonhardt
- LRU eviction now skips active sessions — the cap may be exceeded briefly rather than tearing down MCP servers mid-prompt (fixes a race that broke
mcp__calls). - Evicted runtimes close off the
session/newcritical path, andCloseSessionsshuts down runtimes in parallel (MCP stdio close can take ~5s).
DeepSeek: preserve Responses history ordering (#353) — @shayne-snap
- Keeps the latest user message as the final Responses input instead of appending stale server-side search calls after it; drops failed reasoning-only turns and avoids replaying plain private reasoning.
- Binds each web search call to the assistant response that produced it, satisfying DeepSeek thinking mode's
reasoning → search → function-call → tool-resultordering (previously caused HTTP 400s and stale search content polluting unrelated prompts).
Agent: recover premature end turns (#356) — @shayne-snap
- When the model announces an immediate next action (e.g. "reading file…") but ends the turn without issuing the tool call, Whale now inserts a bounded hidden recovery nudge, clears the incomplete streamed preamble, and continues automatically.
- Recovery is intentionally narrow and capped at two attempts per turn to avoid loops; premature-end events are recorded for monitoring.
Agent: distinguish service shutdown from user interrupt (#351) — @shayne-snap
- Cancellation causes are now preserved through service and turn contexts, so service shutdown no longer persists a misleading user-interrupt marker; adds regression coverage for shutdown cancellation.
PRs
- #350 fix(acp): Never evict sessions with in-flight prompts
- #351 fix(agent): distinguish service shutdown from user interrupt
- #352 fix(acp): Implement session/list so Zed shows previous sessions
- #353 fix(deepseek): preserve Responses history ordering
- #354 fix(acp): Model resolution, API transport, auto-compaction, cap
- #356 fix(agent): recover premature end turns
Thanks
Thanks to @reneleonhardt for the ACP reliability overhaul — model/transport wiring, session listing for Zed, and safe session eviction — and to @shayne-snap for the agent turn recovery, history-ordering fix, and shutdown-cancellation clarity, as well as reviewing and merging the ACP work. 🐋