Skip to content

ListSessions returns IDs only — add cwd, currentModelId, inflight for operator visibility #4

Description

@wjueyao

Summary

AgentRunListSessionsResult currently returns only session IDs:

type SessionListResult struct {
    SessionIDs []string `json:"sessionIds"`
}

For operators inspecting multi-session pools, the missing fields (cwd, current model, in-flight prompt count, optionally created-at) require a follow-up RPC per session, or aren't available at all. The runtime already tracks (id, cwd, models, inflight) on sessionState; surfacing it through the wire layer is mostly plumbing.

Proposed shape

type SessionInfo struct {
    ID             string `json:"id"`
    Cwd            string `json:"cwd"`
    CurrentModelID string `json:"currentModelId,omitempty"`
    Inflight       int    `json:"inflight"`
}

type SessionListResult struct {
    Sessions []SessionInfo `json:"sessions"`
}

(Old SessionIDs []string shape goes away — pure forward-compat add since list-sessions is new in this multi-session work and hasn't shipped to a public release yet. If we wait, the field becomes load-bearing and harder to evolve.)

Touched

  • pkg/agentrun/api/types.go: SessionListResult + new SessionInfo
  • pkg/agentrun/runtime/acp/runtime.go: new Manager.Sessions() []SessionInfo (or extend SessionIDs() — name TBD)
  • pkg/agentrun/server/service.go: ListSessions handler maps runtime → wire
  • pkg/ari/api/types.go: ari mirror types
  • pkg/ari/server/server.go: ari adapter passthrough
  • pkg/ari/client/client.go: client decoding
  • cmd/massctl/commands/agentrun/list_sessions.go: render table instead of one-line-per-id

Estimate

~80 LOC + 2-3 tests, ~45-60 min.

Why deferred from #2

Surfaced in PR #2's second review pass. #2 already focuses on the multi-session feature primitive; this is a feature expansion on top — IDs-only is functional, just not maximally useful. Keeping it as a follow-up keeps PR #2's scope clear and lets each piece be reverted independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions