Skip to content

fix(webapp): show sessions with no live run as Idle instead of Active - #4570

Open
D-K-P wants to merge 6 commits into
mainfrom
sessions-active-climbing-duration
Open

fix(webapp): show sessions with no live run as Idle instead of Active#4570
D-K-P wants to merge 6 commits into
mainfrom
sessions-active-climbing-duration

Conversation

@D-K-P

@D-K-P D-K-P commented Aug 11, 2026

Copy link
Copy Markdown
Member

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.

D-K-P added 2 commits August 11, 2026 16:17
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.
@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 200d501

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Session 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 IDLE display status. Inactive sessions show frozen durations, while never-run idle sessions show a dash. Unit and integration tests cover the status branches and duration behavior. Documentation updates describe the corrected session behavior and tag filtering.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: sessions without a live run now display as Idle.
Description check ✅ Passed The description clearly explains the status, duration, filter, shared derivation, and documentation changes, but omits the template sections for checklist, testing, changelog, and screenshots.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sessions-active-climbing-duration

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

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.
devin-ai-integration[bot]

This comment was marked as resolved.

…ing-duration

# Conflicts:
#	apps/webapp/vitest.config.ts
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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.

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@200d501

trigger.dev

npm i https://pkg.pr.new/trigger.dev@200d501

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@200d501

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@200d501

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@200d501

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@200d501

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@200d501

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@200d501

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@200d501

commit: 200d501

devin-ai-integration[bot]

This comment was marked as resolved.

D-K-P added 2 commits August 12, 2026 16:29
…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.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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.

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +40 to +45
const hasLiveRun =
input.hasCurrentRun &&
input.currentRunStatus !== undefined &&
!isFinalRunStatus(input.currentRunStatus);

return hasLiveRun ? "ACTIVE" : "IDLE";

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.

🔍 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.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant