Repository navigation
fix(tui): scope the memory capability to the agent that has the route - #3988
Conversation
`/memory` was offered on the `email` agent and then 404'd — the exact advertised-then-refused defect #3978 removed, reintroduced on a different agent by its own fix. The gate asked only "is the peer's contract >= 2.13". But every sidecar numbers its own contract, so the same number means different things across them: `email` is already at 2.14 for unrelated reasons and has no memory route at all. Version answers "is this build new enough", never "does this agent have the route" — both have to hold, so the gate now pairs the floor with the agent that owns the memory store, the way `/model` is already scoped in ui/chat/modelcmd.go. Asking for memory on an agent that keeps none says so, rather than telling the user their current agent is out of date. The whole memory test suite was running against a relay client named `email`, which is why nothing caught it; those tests now use the flagship id, and the `email` case is pinned by a test that fails against the shipped gate. Three smaller repairs alongside it: `Supports` answered a confident "known, unsupported" for any capability it had never heard of, so the next one added would be hidden by whichever transport was not taught about it, silently. Unknown is the honest answer. `AgentVersion` decoded only `version`, the flagship's spelling; `email` and both agents' top-level `/version` say `agentVersion`, so the release version was permanently blank there. It accepts both. The agents panel matched a late load result by comparing interface values, which panics at runtime if the dynamic type is uncomparable. A generation counter does the same job with no such edge.
Request changesThe main fix is right: memory is a One of the folded-in repairs regresses something the code it replaced was protecting. Swapping the agents panel's stale-result guard for a plain counter loses the case where a previous panel's abandoned fetch lands on a newly opened one: both start counting from zero, so they match. Close Smaller: the "this agent keeps no memory" refusal is checked after the sidecar is started and probed, so typing Real-world evidenceNo 🔍 Technical details🟡 A previous panel's abandoned load can land on a newly opened one (
|
Two review findings on the previous commit. Swapping the agents panel's stale-result guard for a per-panel counter lost the case the context comparison was catching: both panels start at zero, so a panel closed while its list fetch was in flight could land that fetch's "context canceled" on the panel opened next. Generations now come from a process-wide counter, so two panels can never share one, and the test covers the cross-panel sequence rather than only the same-instance one. The "this agent keeps no memory store" refusal sat after EnsureAgent and the contract probe, so asking for memory on an agent that has none spawned a sidecar purely to say no — and if that probe then failed, the user was told the version could not be confirmed, for a situation with no version in it. The check needs nothing from the network, so it runs first.
|
Both fixed in 16872b9 — and the panel one was a real regression I introduced, not a judgement call. Thanks for reproducing it. Swapping the context comparison for a per-panel counter looked like a pure cleanup and quietly dropped the cross-panel case: both panels start at zero, so a fetch abandoned by panel A lands on panel B. Generations now come from a process-wide counter, so two panels can never share one. 🔍 Verification, and the second fixMutation-verified against the exact failure you described. Reverting the constructor to a per-panel counter turns the new test red with your string, and restoring it turns it green: The test drives the sequence rather than the same-instance case the rewritten one covered: open A → abandon its in-flight load → open B → deliver A's late result, and assert B still shows its own load as in progress. Worth noting the first mutation attempt passed — my Second finding also fixed: the "this agent keeps no memory store" check needs nothing from the peer, so it now runs before Full Go suite green after both (22 packages), On the live-TUI nudge: fair. The |
Adding /slack pushed the block to three lines, which the help overlay cannot render correctly: renderCommandsSection replaces the block by position — the label line plus exactly one continuation — so the third line leaked into every filtered render. Nothing conflicted textually. This branch grew the block while amd#3988 independently landed the test that pins its shape, so the defect only appears once the two meet. Reflowed to two lines, both within the panel's 53-column maximum.
/memoryis currently offered on theemailagent and then 404s — the exact advertised-then-refused defect #3978 removed, reintroduced on a different agent by #3987's own fix. This scopes the capability to the agent that actually has the route.Found by an adversarial review pass whose report arrived after #3987 merged.
Why it slipped through
The gate asked one question: is the peer's contract ≥ 2.13? But every sidecar numbers its own contract independently, so the same number means different things across them —
emailis already at 2.14 for unrelated reasons and has no memory route at all.Verified on a live machine, not just read:
So
Supports(CapabilityMemory)returned(true, true)foremail,/memoryappeared in its palette and/help, andFetchMemorysailed through the contract gate to GET a route that does not exist.Version answers "is this build new enough", never "does this agent have the route" — both have to hold. The gate now pairs the floor with the agent that owns the memory store, the same way
/modelis already scoped inmodelcmd.go. Asking for memory on an agent that keeps none now says exactly that, instead of telling the user their perfectly current agent is out of date.🔍 Why no test caught it, and three smaller repairs
The test suite was aimed at the wrong agent.
fakeRelay.client()builds anSSEClientnamedemail(sse_test.go), so every memory test was exercising an agent with no memory route and passing anyway, because the gate never looked at the id. Those tests now use the flagship id via a newclientFor(t, id), and theemailcase is pinned by a test that fails against the shipped gate.Supportsclaimed to know about capabilities it had never heard of. Thedefault:branch returned(false, true)— a confident "unsupported" — so the next capability added would be hidden by whichever transport was not taught about it, with nothing on screen saying why. That is precisely what the tri-state exists to prevent. Unknown is the honest answer.AgentVersiondecoded onlyversion. That is the flagship's spelling;email's/v1/email/versionand both agents' top-level/versionsayagentVersion, so the release version was permanently blank foremailand fix(tui): the chat never says which agent is answering — the flagship's name is suppressed as a brand duplicate #3979's live-refinement never fired there. It accepts both spellings now, preferringversion.HubAgentListerpassed by value with a slice or map field). A generation counter does the same job with no such edge.Also folded in: a
gofmtmisalignment inchat/model.gothat shipped in #3987, and a test pinning the/helpCommands block at exactly two lines —renderCommandsSectionskips the continuation by position, so a third line would silently leak into every filtered render.Test plan
=== with the fix reverted === --- FAIL: TestSupportsMemoryIsScopedToTheAgentThatHasTheRoute capability_test.go:254: an agent with no memory route must not report the memory capability, whatever its contract number === restored === ok github.com/amd/gaia/tui/internal/client 0.007sgo build ./...,go vet ./...,gofmt -l ./internalall clean (Go 1.26.3, Linux)go test ./... -count=1green — 22 packages, 0 failures (-skip TestCtrlVReadsTheClipboard, which reads the machine's real clipboard)emailrefused despite 2.14; the refusal is not anErrMemoryContractTooOld; an unknown capability reports unknown on both transports;AgentVersionaccepts both wire spellings; an abandoned load cannot overwrite the current listNo Python or docs changes — the sidecar route and its contract are unchanged.