Repository navigation
Description
Part C2 of #1975 (agentop TUI). Parent design: #1975. Depends on B (the key_routes: config map, the key_of invocation detail and SessionSummary.InferenceKeyOf) and A1/A2 (SessionSummary.InferenceServer). Also depends on C1 (servers.KeyRouteChanges, the --key-of commands).
Problem
After C1, the user can switch the server for a key from the shell (agentop server use <s> --key-of <s>). The TUI cannot do it, and it does not show which key a session sent. The TUI and the shell must do the same things.
Goal
The user can switch the server for a key from the TUI and see the effect before they apply it. A key is never shown: agentop names a key only by its server's name.
key_routes: is one hop only (as B defines it): with {team-b: team-a, team-a: team-c}, team-b's key goes to team-a.
Sessions pane S (cmd/agentop/tui/server_picker.go)
Today the picker has one step: select a server, Enter moves the session (openSessionServerPicker :200, serverPickerKey :161, applyServerChoice :243-275).
New: when the session's summary has InferenceKeyOf (sub-issue B) that names a configured server, Enter on a server opens a second step:
Move to: team-a
> This session only
This session and new sessions that send team-b's key (2 other running sessions stay on team-b)
- Row 1 does what Enter does today (
SessionChanges). - Row 2 writes
SessionChangesandKeyRouteChanges(team-b, team-a)in oneWritePluginConfig. When the target isteam-bitself, it removes thekey_routesentry. - Row 2 does not move the other running sessions. A switch changes only new sessions, as the Agents pane switch does today. "N other running sessions stay on team-b" counts the other conversation sessions in
m.sessionswhoseInferenceKeyOfisteam-band whose server isteam-b. FollowsessionsStaying(:478-491). With N = 0, leave the note out. - The helper
servers.KeyRouteChangescomes from C1. - When the session's agent has an
agents:entry, row 2 stays and says why it has no effect for that agent:(claude-code ignores this: the Agents pane sends it to glm). - Esc on the second step goes back to the server list.
- With no
InferenceKeyOf, the picker stays one step, as today. - The flash after the change (
serverSwitchedText:366,sessionSwitchedText:418) says what row 2 changed.
The picker opens its cursor on the session's server from InferenceServer (A2 changes :230).
Agents pane S (openServerPicker, server_picker.go:136)
- The row
ownChoiceEntry = "its own choice (not routed)"(:552) becomesEach terminal's key decides. It writes the same change as today (removes the agent'sagents:entry). - Under it, a muted line counts the agent's conversation sessions in
m.sessionsby the server each one goes to by key: thekey_routes:target of itsInferenceKeyOf(one hop), elseInferenceKeyOf. Example:now: 2 sessions → team-b, 1 → team-a. With no session that sent a known key:no session sends a known key now. - The SERVER cell for an agent with no
agents:entry (agentOwnChoice = "own choice",server_route.go:116) becomesby key.
Docs (cmd/agentop/README.md)
- "Choosing an agent's server (
S)" (:1028-1075): the renamed row and its count line (:1039,:1053). - "Choosing an inference server" (
:1241-1275): the Sessions pane second step. Fix:1268: it says the Sessions pane move confirms the cost first. It does not. It shows a muted line about the cost (server_picker.go:606-607).
Acceptance
Tests assert on substrings, as the existing ones do (tui/server_picker_test.go, sessions_server_test.go:114, server_route_test.go:322):
- Sessions pane: a session with
InferenceKeyOf: team-bgets the second step; row 1 writes only the session entry; row 2 writes the session entry and thekey_routesentry and moves no other session; the "stay on team-b" count is right; a session with noInferenceKeyOfgets one step; the "ignores this" text appears when the agent has anagents:entry; Esc goes back. - Agents pane: the renamed row, the count line, and
by keyin the SERVER cell. - Run
scripts/dev/go-test-shards.sh -short cmd/agentopwhile you work, and oncescripts/dev/go-test-shards.sh -race cmd/agentopplusgo test -race $(go list ./... | grep -v 'agentop$')fromcmd/agentopbefore the PR.
Assisted-By: Claude (Anthropic AI) noreply@anthropic.com
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
docs: Add the plan for #1981, S switches the server for a key
docs: Tell how a test seeds key_routes in the plan for #1981
feat: Show the server whose key a session sent on its summary