Repository navigation
Fix: Show a pending bucket's agent and purpose in agentop instead of its raw id - #1270
Conversation
A pending bucket — where an agent's calls that name no session collect until one does — is listed by the server like any session, with no title and no agent. Its row was therefore "pending:openc…" and nothing else: a truncated id that named nothing, read as unfinished, and, being the most recently updated row whenever the agent was chatty, sat near the top. The SESSION cell now shows the agent, the TITLE cell falls back to "calls outside any session · pid <n>" when nothing else names the bucket, the AGENT cell takes the agent from the id, and pending buckets list after the real sessions. A served or harvested title still wins, and the fallback lives in sessionTitleFor rather than sessionTitle so the re-harvest backoff never reads a bucket as named. Headers keep the full id. Rendering only: the server's id, the API and the agents picker's Other scope are unchanged. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes review: pending buckets were reordered among server-listed rows only, so after a proxy restart a listed bucket sat above the cached-only real sessions (sessions_pane.go:268) Files: - cmd/agentop/tui/pending_bucket.go - cmd/agentop/tui/pending_bucket_test.go - cmd/agentop/tui/sessions_pane.go Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
pdettori
left a comment
There was a problem hiding this comment.
Solid, well-scoped rendering fix. The parser correctly targets the real pending:<agent>[@<pid>.<start>] format (matches PendingProcessID in core/session/process.go), the title fallback correctly lives in sessionTitleFor rather than sessionTitle so the re-harvest backoff never reads a bucket as named, and the ordering change preserves the rows/ids lockstep in both the server-listed and cached-only paths. Tests are table-driven and assertive, and the deferred-from-review list is accurate — every listed item is genuinely present in the code as described. No must-fix issues.
Author: huang195 (MEMBER — maintainer)
Areas reviewed: Go, Tests, Docs
Agent/IDE config (.claude/.vscode): none
Commits: 2, all signed-off: yes
CI status: all green
🤖 Assisted-By: Claude Code
| rows, ids = append(rows, bucketRows...), append(ids, bucketIDs...) | ||
| // ONLY WHEN THE HEADER ACTUALLY CHANGES, which is a resize and nothing else. SetRows(nil) | ||
| // resets the viewport's offset, and this function runs on every poll — clearing | ||
| // unconditionally scrolled the picker back under the operator twice a second, which |
There was a problem hiding this comment.
suggestion: Cursor preservation across the bucket reorder is claimed via sessionRowIDs, but no test plants a cursor on a real session and then rebuilds with a bucket appearing/disappearing around it — the cached-source test only checks the default cursor. A test would pin the claim rather than leave it to the mechanism's continued correctness.
| {"pending:claude-code", "claude-code", "", true}, | ||
| {"pending:", "", "", false}, | ||
| {session.DefaultSessionID, "", "", false}, | ||
| {uuidOpened, "", "", false}, |
There was a problem hiding this comment.
suggestion: This test asserts Rows()[0] directly instead of using the file's own rowOf helper, and only covers the served-title precedence. A harvested-title-wins case would close the PR description's claim that both title sources take precedence over the fallback.
| } | ||
| if agentW > 0 { | ||
| row = append(row, emptyCell) | ||
| row = append(row, sessionAgentCell(session.SessionSummary{ID: id}, agentW)) |
There was a problem hiding this comment.
suggestion (deferred-list visibility): cached non-bucket rows now show "" under AGENT where they showed — (emptyCell). Acknowledged in the PR body — flagging so it isn't rediscovered as a regression later.
| return trunc(sanitizeLabel(agent), w) | ||
| } | ||
| return trunc(id, w) | ||
| } |
There was a problem hiding this comment.
nit: The bucket branch sanitizes the agent (sanitizeLabel) but the non-bucket branch truncates the raw id unsanitized. Presumably intentional (server-issued ids vs client-shaped agent names) — a one-line comment would settle it.
Summary
A
pending:bucket is where a coding agent's calls that name no session collect until one does. The server lists it like any session, with no title and no agent, so in agentop it showed up as:That is a truncated id that names nothing and looks unfinished. A chatty bucket was also often the most recently updated row, so it sat near the top. With this PR the same rows render as:
(Captured from the sessions table on this branch, using test fixtures.)
Change
The change is in
cmd/agentop/tui/pending_bucket.go, plus three call sites insessions_pane.go.pending:<agent>[@<pid>.<start>]. It shows only the agent, notagent·pid, because the column is 14 characters wide andclaude-code·89949would lose the pid to truncation.calls outside any session · pid <n>, or justcalls outside any sessionfor an agent-wide bucket, when nothing else names it.sessionTitleFor, the display precedence, and not insessionTitle. The re-harvest backoff readssessionTitleas "named", so a bucket never counts as named.calls outside any session · pid 45462 (pending:opencode@…), which still includes the full id.Agentblank, which it does for every bucket.sessionRowIDs, so the cursor and drill-down are unaffected.Unchanged: the server's id, the API, the
defaultbucket, and the agents picker, which still lists buckets underOther. The same rendering applies to rows kept alive only by agentop's cache after the proxy has forgotten them.Related: #1269 stops OpenCode's own polling from filling the bucket after a proxy restart. That was the case that made this row hard to ignore. A bucket can still appear legitimately, for example from OpenCode's local-model probes or Bob's startup calls before its first header, which is why this PR is still needed.
Tests
cmd/agentop/tui/pending_bucket_test.go:pending:,defaultand a UUIDAll were seen failing before the change.
env -u SSL_CERT_FILE GOWORK=off go test ./...incmd/agentoppasses;go vetandgofmt -lare clean. The README's sessions-pane section describes the new row.Deferred from review
sessions_pane.go:335: a cached-only row that is not a bucket shows""under AGENT where it used to show—(emptyCell).pending_bucket.go:47: the AGENT cell names a bucket's agent, but choosing that agent in the picker hides the row, which stays underOther.README.md:682:/also matches the fallback title, not only the id.pending_bucket_test.go:12: fixtures hand-write the pending id format instead of building it withsession.PendingProcessID/PendingSessionID.sessions_pane.go:270: why buckets list last is not stated whereemitsplits them out.Assisted-By: Claude (Anthropic AI) [email protected]