feat: add GET /api/sessions?active=true for lightweight attached-session listing - #4244
Conversation
…ion listing Returns only runtimes currently attached to this server with working_dir and streaming status, no session-history read. Assisted-By: Claude
docker-agent
left a comment
There was a problem hiding this comment.
docker-agent to retry.
|
👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push. Commits that are not verified: See GitHub's guide on signing commits for setup instructions. I've added |
|
Wait, how many sessions do you have?? Why would this be slow, we made sure to only get the metadata when returning the sessions |
|
Verified directly in the local Docker Agent database:
|
GET /api/sessionsreads the full session history from disk on every call. On a project with many past sessions this can easily take over 15 seconds, which makes it impractical for supervising clients — like a board UI — that need to periodically poll for active TUI tabs and aggregate their streaming state.This adds an
?active=truequery parameter to the endpoint. When set, the handler skips history entirely and returns only the runtimes that are currently attached in memory, each one carryingworking_dirand the live streaming flag. The response is immediate because no disk I/O is involved. The existing unfiltered path is unchanged, so nothing breaks for callers that need the full history.Validation:
go test -race ./pkg/server ./pkg/api ./pkg/runtime,task lint,task build.