Commit Graph
7 Commits
Author SHA1 Message Date
Anthony Ruiz e3db8f7e01 fix: settle steer on every terminal path and preserve recovery drafts 2026-09-20 17:07:58 +00:00
Anthony Ruiz 034e3edef7 fix(streaming): publish initial run and cancellation signal atomically 2026-09-20 17:07:57 +00:00
Anthony Ruiz a98d0c86d0 fix(steer): fence worker registration and final pending drain 2026-09-20 17:07:57 +00:00
Anthony Ruiz 26277f933b fix(steer): revalidate the active-run backend on the cache-only path
The cache-only Steer path only special-cased backend == "gateway" and sent
every other value — including a missing, empty, or unknown backend — to the
cached local agent. Another runtime could own the run while guidance was
enqueued on a stale local agent.

Fail closed instead: the in-process worker now registers its active run with
the explicit local backend tag (WEBUI_LOCAL_CHAT_BACKEND, the same "legacy"
value webui_chat_backend_mode() returns), and cache-only Steer only enqueues
agent.steer() on that tag. Gateway keeps its gateway_steer_queued outcome; a
missing, empty, or foreign backend returns stream_dead without steering.

Extends the positive-ownership regression with backend cases and adds a
worker-side check that the local backend tag is actually registered.
2026-09-20 17:07:57 +00:00
Anthony Ruiz 20c16e9167 fix(steer): require positive ownership on the cache-only path
The cache-only Steer branch (no AGENT_INSTANCES worker) only rejected
*conflicting* ownership, so a missing stream owner or a missing
active-run session_id was treated as non-conflicting and let
agent.steer() run and report accepted without proving the requesting
session owns the run.

Fail closed instead: both the stream owner and the active-run session
must be present and strictly equal to the requesting session (backend
and phase are still revalidated) under the same STREAMS_LOCK ->
ACTIVE_RUNS_LOCK edge; any absent identity returns stream_dead without
calling agent.steer(). No cache eviction, no agent closing, HTTP write
still outside the locks.

Regressions: missing owner, missing/empty run session, both missing,
missing run entry -> stream_dead + steer never called; both present and
equal -> accepted, cache untouched. Legacy happy-path fixtures now
register the ownership they rely on.
2026-09-20 17:07:57 +00:00
Anthony Ruiz 91bd3e03b9 fix(steer): honor Gateway ownership before local cache fallback 2026-09-20 17:07:57 +00:00
Anthony Ruiz c6152e4182 fix(steer): target the owned active worker after compression 2026-09-20 17:07:57 +00:00