perf(sessions): Adapter.Session() always builds the session tree; add a cheap SessionSummary for status-only callers #717
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
follow-up
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#717
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up from the perf report (item 9).
Symptom: `internal/platforms/opencode/adapter_session_detail.go:46-73` always runs `attachSessionTree` = `GetSessionTree` + one `GetSessionMessages` per tree node (largest tree here: 126 sessions → 126 queries) purely to compute est-cost, plus the live full-conversation fetch. Callers that only need status/title:
Fix: add `SessionSummary(id)` on the adapter (live registry + `db.GetSessionSummary`, now ~0.2 ms) and use it in those callers; make `attachSessionTree` lazy (detail handler only) and compute tree cost from `session.cost/tokens_*` when the schema has them (`DB.sessionTotals`) instead of loading messages.