fix(webapp): show sessions with no live run as Idle instead of Active - #4570
fix(webapp): show sessions with no live run as Idle instead of Active#4570D-K-P wants to merge 6 commits into
Conversation
Session status was derived only from closedAt/expiresAt, so an open session whose run had already finished stayed Active forever and its duration ticked up from createdAt without end. Status is now derived from the current run's liveness: a session with no live run reads Idle, and its duration freezes at the run's completion instead of counting up. Active is reserved for sessions with a run actually executing. Applies to the sessions list and the session detail page.
The tag filter matches the session's own top-level tags, not triggerConfig.tags.
|
WalkthroughSession status derivation now distinguishes closed, expired, active, and idle sessions using session lifecycle fields and current-run state. Session list results include current run completion timestamps. The route and session components support the 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Address review on the sessions status change: - Keep the "Close session" action on the detail page for Idle sessions; they are open, only Closed and Expired are terminal. - Rename the status helper input from currentRunId to hasCurrentRun, since the detail page passes a run friendlyId, not the session's currentRunId. - Restore the Active tooltip copy so it stays accurate now that the Active filter also returns open, idle sessions. - Align the sessions docs example so the listed tag matches a top-level tag set at start time.
…ing-duration # Conflicts: # apps/webapp/vitest.config.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
…ing-duration # Conflicts: # apps/webapp/vitest.config.ts
The run/span panel derived the session badge from closedAt/expiresAt only, so it could read Active where the sessions list and detail page now read Idle. It now uses the same run-liveness derivation as the rest of the sessions surface.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
| const hasLiveRun = | ||
| input.hasCurrentRun && | ||
| input.currentRunStatus !== undefined && | ||
| !isFinalRunStatus(input.currentRunStatus); | ||
|
|
||
| return hasLiveRun ? "ACTIVE" : "IDLE"; |
There was a problem hiding this comment.
🔍 Unresolvable current-run pointer silently downgrades a live session to Idle
deriveSessionStatus treats currentRunStatus === undefined as not-live, and the presenter's run lookup is fenced by projectId + runtimeEnvironmentId (apps/webapp/app/presenters/v3/SessionListPresenter.server.ts:191-204). Any case where the run row isn't readable from Postgres — most plausibly a freshly triggered run still sitting in the mollifier buffer before the drainer materialises it (see the buffered fallback in apps/webapp/app/presenters/v3/SpanPresenter.server.ts:157-183) — renders the session as Idle with a dash duration even though a run is genuinely starting. Previously such a session read Active. The window is transient and only applies where buffering is enabled, but it is worth confirming the sessions list is not a surface where new sessions routinely appear during that window.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
An abandoned chat session (never closed, its run long since finished) showed as Active on the Sessions list with a duration that counted up from creation forever. Session status now reflects whether a run is actually live: a session with no running run reads Idle, and its duration freezes at when the run finished. Active is kept for sessions with a run genuinely executing. Closed and Expired are unchanged. The same derivation now backs the session detail page, so the list and detail no longer disagree.
Fix
Status was derived only from closedAt/expiresAt and never looked at the current run. A small shared helper now folds in the current run's status (via the run pointer the list already loads), so it can tell open-but-idle from live. The status filter is untouched: Idle is display only, so there is no ClickHouse or migration change, and filtering by Active still returns open sessions.
Also corrects the sessions.list docs, where the tag filter was described as matching triggerConfig.tags. It actually matches the session's own top-level tags.