Skip to content

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

Open
D-K-P wants to merge 4 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 4 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: 5b9c8dc

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8fc8a248-3eba-4913-aa3e-0e193ae0d92e

📥 Commits

Reviewing files that changed from the base of the PR and between 4569657 and 5b9c8dc.

📒 Files selected for processing (11)
  • .server-changes/sessions-idle-status.md
  • apps/webapp/app/components/sessions/v1/SessionStatus.tsx
  • apps/webapp/app/components/sessions/v1/SessionsTable.tsx
  • apps/webapp/app/presenters/v3/SessionListPresenter.server.ts
  • apps/webapp/app/presenters/v3/deriveSessionStatus.test.ts
  • apps/webapp/app/presenters/v3/deriveSessionStatus.ts
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsx
  • apps/webapp/app/services/sessionsRepository/sessionsRepository.server.ts
  • apps/webapp/test/sessionListPresenterStatus.test.ts
  • apps/webapp/vitest.config.ts
  • docs/ai-chat/sessions.mdx
🚧 Files skipped from review as they are similar to previous changes (10)
  • docs/ai-chat/sessions.mdx
  • apps/webapp/app/services/sessionsRepository/sessionsRepository.server.ts
  • .server-changes/sessions-idle-status.md
  • apps/webapp/app/presenters/v3/deriveSessionStatus.test.ts
  • apps/webapp/app/presenters/v3/deriveSessionStatus.ts
  • apps/webapp/test/sessionListPresenterStatus.test.ts
  • apps/webapp/app/components/sessions/v1/SessionsTable.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsx
  • apps/webapp/app/presenters/v3/SessionListPresenter.server.ts
  • apps/webapp/app/components/sessions/v1/SessionStatus.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout. (19)
  • GitHub Check: report
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 12)
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: typecheck / typecheck
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: code-quality / code-quality
  • GitHub Check: audit
  • GitHub Check: audit
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Build and publish previews
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead

**/*.{ts,tsx}: Prefer static imports over dynamic import(); use dynamic imports only for unresolvable circular dependencies, genuine performance code splitting, or conditional runtime loading.
Import Trigger.dev tasks from @trigger.dev/sdk; never use @trigger.dev/sdk/v3 or deprecated client.defineJob.
Add agentcrumbs while writing code using approved namespaces; mark lines with // @Crumbs or blocks with `// `#region` `@crumbs, and strip them before merging.

Files:

  • apps/webapp/vitest.config.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use zod for validation in packages/core and apps/webapp

Files:

  • apps/webapp/vitest.config.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use function declarations instead of default exports

Files:

  • apps/webapp/vitest.config.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries

Files:

  • apps/webapp/vitest.config.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: Access environment variables through the env export of env.server.ts instead of directly accessing process.env
Use subpath exports from @trigger.dev/core package instead of importing from the root @trigger.dev/core path

Do not reintroduce the removed v1 execution path; RunEngineVersion.V1 branches may only reject or finalize gracefully so v3 clients receive a clean 4xx, never a 5xx.

Files:

  • apps/webapp/vitest.config.ts
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

For apps, use typecheck for verification and never use build as the correctness check.

Files:

  • apps/webapp/vitest.config.ts
🧠 Learnings (13)
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma error P1001 ("Can't reach database server") in TypeScript, don’t assume a single error shape. Prisma can surface P1001 via two different error classes/fields: `PrismaClientKnownRequestError` exposes it as `err.code === "P1001"` (common during mid-query connection drops), while `PrismaClientInitializationError` exposes it as `err.errorCode === "P1001"` (common on client startup failure). Therefore, predicates should use `err.code === "P1001" || err.errorCode === "P1001"`. Do not flag `err.code === "P1001"` as “unreachable/never matches,” as it is expected in production.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma errors for P1001 ("Can't reach database server"), do not assume it only appears under a single property name. Prisma may surface P1001 via either `PrismaClientKnownRequestError` (`err.code === "P1001"`, e.g., mid-query connection drops) or `PrismaClientInitializationError` (`err.errorCode === "P1001"`, e.g., client startup connection failure). To reliably detect the condition, check `err.code === "P1001" || err.errorCode === "P1001"`, and avoid review rules that would incorrectly flag `err.code === "P1001"` as unreachable/never-matching.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-06-13T19:53:13.759Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3937
File: packages/trigger-sdk/skills/realtime-and-frontend/SKILL.md:258-260
Timestamp: 2026-06-13T19:53:13.759Z
Learning: When reviewing code that uses `trigger.dev/react-hooks`’s `useRealtimeRun`, preserve the call signature where the first argument is the full realtime handle object (not `handle.id`). This is intentional to maintain type-safety and is consistent with the official docs; do not suggest changing the first argument from the handle object to `handle.id`.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-06-17T17:13:49.929Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3948
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx:48-62
Timestamp: 2026-06-17T17:13:49.929Z
Learning: In triggerdotdev/trigger.dev, within `dashboardLoader`/`dashboardAction` (or similar context resolver code) whenever you resolve an organization ID from an organization slug for RBAC/enterprise authorization scope, always read from the primary Prisma client (`prisma`), not `$replica`. Using `$replica` can hit replica-lag and cause the RBAC lookup/authorization to run without the correct org scope (bypassing intended role enforcement). Implement the slug→org lookup with `prisma.organization.findFirst(...)` (or equivalent primary-client query) and add an inline comment documenting why the primary client is required (replica lag could lead to unscoped RBAC checks).

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-06-23T13:04:21.413Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4023
File: apps/webapp/app/services/upsertBranch.server.ts:14-18
Timestamp: 2026-06-23T13:04:21.413Z
Learning: In TypeScript, it’s valid to `import { type X }` and then use `typeof X` in a type-only position, e.g. `type Alias = z.infer<typeof X>`. The `type` modifier suppresses the runtime import, but the type checker still has the full exported type so `z.infer<typeof X>` can resolve correctly. In code reviews, don’t flag this as a TypeScript compile error as long as `typeof X` is used in a type context (e.g., with `z.infer`, `type` aliases, generics), not as a runtime value.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-05-01T15:45:08.099Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3499
File: packages/plugins/tsup.config.ts:3-3
Timestamp: 2026-05-01T15:45:08.099Z
Learning: In build/tool configuration files (e.g., tsup.config.ts, vite.config.ts, vitest.config.ts), follow the tool’s documented export pattern and use `export default defineConfig(...)` (or the equivalent documented default export). The repo-wide guideline “use named exports instead of default exports” should apply only to application code (*.{ts,tsx,js,jsx}), not to these build/tool config files—so do not flag `export default defineConfig(...)` in these config files as a violation.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-05-12T21:04:05.815Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3542
File: apps/webapp/app/components/sessions/v1/SessionStatus.tsx:1-3
Timestamp: 2026-05-12T21:04:05.815Z
Learning: In this Remix + TypeScript codebase, do not flag a server/client boundary violation when a file imports only types from a module matching `*.server`.

Specifically, it’s safe to import types using `import type { Foo } from "*.server"` or `import { type Foo } from "*.server"` because TypeScript erases type-only imports at compile time and they emit no JavaScript, so they won’t cross the Remix server/client bundle boundary.

Only raise the boundary concern for value imports (e.g., `import { Foo }` without `type`, or `import Foo`), since those produce JavaScript output.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-06-25T18:21:51.905Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4039
File: apps/webapp/app/routes/invite-revoke.tsx:0-0
Timestamp: 2026-06-25T18:21:51.905Z
Learning: During the Zod v4 migration in the triggerdotdev/trigger.dev webapp, ensure any imports from `conform-to/zod` use the Zod-4 subpath: `conform-to/zod/v4` (e.g., `import { parseWithZod } from "conform-to/zod/v4"`). Do not import from the package root `conform-to/zod`, because it is the Zod 3 implementation and may load Zod-3-only symbols (e.g., `ZodBranded`, `ZodEffects`), which can throw at module load (notably with `zod4.4.3`). This should be enforced across `apps/webapp/**/*` where helpers like `parseWithZod` and `conformZodMessage` are used.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-07-03T17:10:21.498Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 4148
File: apps/webapp/app/models/orgMember.server.ts:149-168
Timestamp: 2026-07-03T17:10:21.498Z
Learning: In triggerdotdev/trigger.dev, `User.email` (Prisma schema: `internal-packages/database/prisma/schema.prisma`) currently does NOT use `citext` and does NOT have a `lower(email)` functional unique index. Therefore, do not introduce Prisma queries like `where: { email: { equals: <value>, mode: "insensitive" } }` (or any case-insensitive lookup) against `User.email`, because it can force sequential scans of the `users` table under load. During review, ensure email is normalized (e.g., lowercased/trimmed) before both writes and subsequent lookups, and if true case-insensitive behavior/uniqueness is required, implement it via a separate app-wide migration (e.g., switch to `citext` and/or add a functional unique index with backfill) rather than bolting it onto individual feature PRs.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-06-04T18:16:35.386Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3836
File: apps/supervisor/src/backpressure/backpressureMonitor.ts:3-5
Timestamp: 2026-06-04T18:16:35.386Z
Learning: When reviewing TypeScript in this repo, apply the rule “prefer type aliases over interfaces” only to data/object shapes and union/intersection type modeling. If an interface is being used as a behavioral contract for collaborators to implement (e.g., method-shape interfaces that define required behavior, such as `BackpressureLogger` / `BackpressureSignalSource` in `apps/supervisor/src/backpressure/backpressureMonitor.ts`), keep it as an `interface` and do not flag it as a type-alias-vs-interface violation.

Applied to files:

  • apps/webapp/vitest.config.ts
📚 Learning: 2026-06-09T17:58:04.699Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 3879
File: apps/webapp/app/models/vercelIntegration.server.ts:619-630
Timestamp: 2026-06-09T17:58:04.699Z
Learning: In this codebase, outbound raw `fetch` calls should typically rely on Node/undici’s default request timeout (about ~300s) rather than adding a per-call `AbortController` + `setTimeout` wrapper inside individual functions (e.g. in files like `apps/webapp/app/models/vercelIntegration.server.ts`). During code review, do not flag the absence of a per-call timeout on a single `fetch` as an issue; if per-call timeouts are needed, they should be implemented via a codebase-wide convention (e.g., a shared fetch wrapper or documented pattern) rather than ad-hoc per-function changes.

Applied to files:

  • apps/webapp/vitest.config.ts
🔇 Additional comments (1)
apps/webapp/vitest.config.ts (1)

23-23: LGTM!


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 | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and its scope, but it omits the required issue, checklist, testing, changelog, and screenshots sections. Add the template sections, link the issue, complete the checklist, document testing steps, add a changelog entry, and provide screenshots or state that none apply.
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: sessions without a live run now display as Idle.
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 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 3 potential issues.

Open in Devin Review

Comment thread apps/webapp/app/components/sessions/v1/SessionStatus.tsx
Comment on lines +22 to +83
vi.mock("~/db.server", async () => {
const { Prisma } = await import("@trigger.dev/database");
const lazyProxy = (holder: { client: any }, label: string) =>
new Proxy(
{},
{
get(_t, prop) {
if (!holder.client) throw new Error(`${label} not set for this test`);
const value = holder.client[prop];
if (value !== null && typeof value === "object") {
return new Proxy(value, { get: (_d, method) => holder.client[prop][method] });
}
return value;
},
}
);
return {
prisma: lazyProxy(primaryHolder, "primaryHolder.client"),
$replica: lazyProxy(replicaHolder, "replicaHolder.client"),
runOpsNewPrismaClient: undefined,
runOpsNewReplicaClient: undefined,
runOpsLegacyPrisma: undefined,
runOpsLegacyReplica: undefined,
sqlDatabaseSchema: Prisma.sql([`public`]),
};
});

// Orthogonal peripherals.
const STUB_ENV = {
id: "env_stub",
type: "DEVELOPMENT" as const,
slug: "dev",
organizationId: "org_stub",
projectId: "proj_stub",
userId: undefined,
branchName: null,
git: null,
};

vi.mock("~/models/runtimeEnvironment.server", () => ({
findDisplayableEnvironment: async () => STUB_ENV,
}));

vi.mock("~/v3/models/workerDeployment.server", () => ({
findCurrentWorkerFromEnvironment: async () => null,
}));

// The session list comes from ClickHouse via SessionsRepository — orthogonal to the run read.
// The stub returns controlled session rows whose currentRunId points at runs we seed for real.
const sessionListHolder = vi.hoisted(() => ({ sessions: [] as any[] }));
vi.mock("~/services/sessionsRepository/sessionsRepository.server", () => ({
LEGACY_PLAYGROUND_TAG: "__playground__",
SessionsRepository: class {
constructor(_deps: any) {}
async listSessions() {
return {
sessions: sessionListHolder.sessions,
pagination: { nextCursor: null, previousCursor: null },
};
}
},
}));

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.

🟡 New test relies on module mocking, which the repository forbids

The added integration test stubs out the database module, the environment lookup, the worker lookup and the sessions repository with vi.mock (apps/webapp/test/sessionListPresenterStatus.test.ts:22-83), which contradicts the repository's testing rule to never mock anything and use testcontainers instead.
Impact: The test violates the project's mandatory testing convention.

Rule reference

AGENTS.md, "Testing": "We use vitest exclusively. Never mock anything - use testcontainers instead." The test does use a real Postgres container for runs, but replaces ~/db.server, ~/models/runtimeEnvironment.server, ~/v3/models/workerDeployment.server and ~/services/sessionsRepository/sessionsRepository.server with mocks.

Open in Devin Review

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows an existing merged pattern: apps/webapp/test/presentersSessionBatchReplicaLag.guard.test.ts drives the same presenter against a real Postgres (testcontainer) while stubbing only orthogonal peripherals (the ~/db.server proxies, displayable-env, worker probe, and the ClickHouse-backed SessionsRepository, which only supplies ordered ids). The system under test (the presenter's run read + status derivation) and its Postgres data are real; only the ClickHouse index and control-plane lookups are stubbed to keep this to one container. Leaving open for a maintainer's call on the pattern.

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@5b9c8dc

trigger.dev

npm i https://pkg.pr.new/trigger.dev@5b9c8dc

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@5b9c8dc

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@5b9c8dc

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@5b9c8dc

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@5b9c8dc

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@5b9c8dc

@trigger.dev/schema-to-json

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

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@5b9c8dc

commit: 5b9c8dc

@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 2 new potential issues.

Open in Devin Review

Comment thread apps/webapp/app/presenters/v3/SessionListPresenter.server.ts
Comment on lines +31 to +46
export function deriveSessionStatus(input: DeriveSessionStatusInput): SessionDisplayStatus {
if (input.closedAt != null) {
return "CLOSED";
}

if (input.expiresAt != null && input.expiresAt.getTime() < input.now) {
return "EXPIRED";
}

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.

🔍 Run detail page still derives session status the old way, so it can disagree with the new Idle label

The run/span page renders a session badge from run.session.status, which apps/webapp/app/presenters/v3/SpanPresenter.server.ts:373-379 still derives from closedAt/expiresAt only. After this PR, an open session whose current run has terminated reads IDLE on the sessions list and the session detail page, but still reads ACTIVE on the run's span panel. Same for the agent activity chart legend (apps/webapp/app/presenters/v3/AgentDetailPresenter.server.ts:34). Not strictly wrong (those surfaces are also fed by the three-value model), but the PR's stated goal of list/detail agreement leaves this third surface behind.

Open in Devin Review

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good flag, splitting it in two:

  • Agent activity chart (AgentDetailPresenter): this is a ClickHouse aggregation over closedAt/expiresAt, i.e. the same aggregation class as the status filter. Idle is display-only and intentionally not represented in aggregation/filter surfaces, so this one deliberately stays ACTIVE/CLOSED/EXPIRED.
  • Run/span panel session badge (SpanPresenter:373): agreed this is a display badge like the list and detail page, so for full consistency it should reuse deriveSessionStatus. It needs the session's current-run status available there (an extra field to load). That is beyond this ticket's list+detail scope, so leaving this open for the maintainer to decide whether to fold in here or track as a follow-up.

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