-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(webapp): stop session durations climbing when no run is live #4570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a1ffd4a
fix(webapp): show sessions with no live run as Idle instead of Active
D-K-P 799dbb4
docs(ai-chat): correct the sessions.list tag filter description
D-K-P e67dc2b
fix(webapp): keep the close action available for idle sessions
D-K-P 5b9c8dc
Merge remote-tracking branch 'origin/main' into sessions-active-climb…
D-K-P 3947881
Merge remote-tracking branch 'origin/main' into sessions-active-climb…
D-K-P 200d501
fix(webapp): show Idle session status on the run page badge too
D-K-P 3dfca81
fix(webapp): stop session durations climbing forever when no run is live
D-K-P 5ff9905
Merge remote-tracking branch 'origin/main' into sessions-active-climb…
D-K-P b271116
chore: rename sessions server-changes note to match the shipped fix
D-K-P File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: fix | ||
| --- | ||
|
|
||
| The Sessions list no longer shows an ever-growing duration for a session whose run finished long ago. The duration now stops at the last run's activity, and only sessions with a run still executing keep counting up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { isSessionLive } from "./isSessionLive"; | ||
|
|
||
| describe("isSessionLive", () => { | ||
| it("is live when the current run is executing", () => { | ||
| expect(isSessionLive({ hasCurrentRun: true, currentRunStatus: "EXECUTING" })).toBe(true); | ||
| }); | ||
|
|
||
| it("treats any non-final run status as live", () => { | ||
| expect(isSessionLive({ hasCurrentRun: true, currentRunStatus: "PENDING" })).toBe(true); | ||
| }); | ||
|
|
||
| it("is not live when the current run has reached a terminal state", () => { | ||
| expect(isSessionLive({ hasCurrentRun: true, currentRunStatus: "EXPIRED" })).toBe(false); | ||
| }); | ||
|
|
||
| it("is not live when there is no current run", () => { | ||
| expect(isSessionLive({ hasCurrentRun: false, currentRunStatus: undefined })).toBe(false); | ||
| }); | ||
|
|
||
| it("is not live when the current run pointer can't be resolved (status unknown)", () => { | ||
| expect(isSessionLive({ hasCurrentRun: true, currentRunStatus: undefined })).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { type TaskRunStatus } from "@trigger.dev/database"; | ||
| import { isFinalRunStatus } from "~/v3/taskStatus"; | ||
|
|
||
| export type IsSessionLiveInput = { | ||
| /** Whether the session points at a current run at all. */ | ||
| hasCurrentRun: boolean; | ||
| /** | ||
| * Status of the current run. `undefined` when there is no current run, or the | ||
| * pointer couldn't be resolved (stale / cross-env). | ||
| */ | ||
| currentRunStatus: TaskRunStatus | undefined; | ||
| }; | ||
|
|
||
| /** | ||
| * A session is "live" when its current run is still executing (a non-final run | ||
| * status). This drives whether the session's duration ticks or freezes; it does | ||
| * NOT change the session's status, which stays the filterable | ||
| * `ACTIVE`/`CLOSED`/`EXPIRED` set derived from `closedAt`/`expiresAt`. | ||
| */ | ||
| export function isSessionLive({ hasCurrentRun, currentRunStatus }: IsSessionLiveInput): boolean { | ||
| return hasCurrentRun && currentRunStatus !== undefined && !isFinalRunStatus(currentRunStatus); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.