Skip to content

feat: add GET /api/sessions?active=true for lightweight attached-session listing - #4244

Merged
aheritier merged 1 commit into
docker:mainfrom
dgageot:fix/attached-session-status
Sep 11, 2026
Merged

aheritier merged 1 commit into
docker:mainfrom
dgageot:fix/attached-session-status

Conversation

@dgageot

@dgageot dgageot commented Sep 11, 2026

Copy link
Copy Markdown
Member

GET /api/sessions reads 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=true query parameter to the endpoint. When set, the handler skips history entirely and returns only the runtimes that are currently attached in memory, each one carrying working_dir and 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.

…ion listing

Returns only runtimes currently attached to this server with working_dir and
streaming status, no session-history read.

Assisted-By: Claude
@dgageot
dgageot requested a review from a team as a code owner September 11, 2026 17:09

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Review did not complete — The agent ran but did not post a review. View logs for details. Re-request a review from docker-agent to retry.

@aheritier aheritier added area/api For features/issues/fixes related to the usage of the cagent API area/core Core agent runtime, session management area/docs Documentation changes kind/feat PR adds a new feature (maps to feat:). Use on PRs only. status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key labels Sep 11, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 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: 5ddb440

See GitHub's guide on signing commits for setup instructions. I've added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@rumpl

rumpl commented Sep 11, 2026

Copy link
Copy Markdown
Member

Wait, how many sessions do you have?? Why would this be slow, we made sure to only get the metadata when returning the sessions

@aheritier aheritier removed the status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key label Sep 11, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

Verified directly in the local Docker Agent database:

  • 908 top-level conversation sessions
  • 6,107 sub-sessions
  • 7,015 total session records

@aheritier
aheritier added this pull request to the merge queue Sep 11, 2026
Merged via the queue into docker:main with commit affcfb0 Sep 11, 2026
29 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api For features/issues/fixes related to the usage of the cagent API area/core Core agent runtime, session management area/docs Documentation changes kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants