Skip to content

v0.1.65

Choose a tag to compare

@shayne-snap shayne-snap released this 06 Aug 11:14
44240a9

v0.1.65

Summary

This release hardens the ACP (Agent Client Protocol) runtime and the agent turn loop:

  1. 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/list support so Zed shows previous sessions, and no more mid-prompt eviction of sessions with in-flight requests.
  2. 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_MODEL is validated against supported models at startup (invalid values fail fast) with fallback to deepseek-v4-flash; names are lowercase-canonicalized so a single name feeds both the provider and context-window derivation. The retired deepseek-chat alias is now rejected.
  • API transport: new deepseek.API setting (auto | responses | chat_completions) exposed via WHALE_API (env > config > heuristic); web_search=server implies Responses, and chat_completions + server-side search degrades search to local with a warning instead of refusing to start. Wired through all runtime construction sites, including the web_fetch extractor.
  • 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: DefaultMaxToolIters raised to 300 (from 100), configurable via WHALE_MAX_TOOL_ITERS; 0/negative values rejected.
  • Env knobs: WHALE_MODEL, WHALE_API, WHALE_COMPACT_THRESHOLD, WHALE_CONTEXT_WINDOW, WHALE_MAX_TOOL_ITERS read once at startup.
  • Hardening: rejects NaN/±Inf thresholds, honors web_search=local on the Responses transport, normalizes whitespace/case in WHALE_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

  • initialize now advertises sessionCapabilities {list:{}}, so Zed's agent panel can show whale session history.
  • session/list lists persisted sessions from the same store session/load uses: 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 cwd filter; orders by recency with deterministic tie-breaks. session/delete remains 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/new critical path, and CloseSessions shuts 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-result ordering (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

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. 🐋