Skip to content

Commit 1984b34

Browse files
committed
feat(webapp,database): show a Test column for agent sessions
Sessions started from the agent Test playground were tagged with a "playground" tag that rendered in the Sessions table. They are now flagged with a real Session.isTest boolean (mirroring TaskRun.isTest) and shown as a dedicated "Test" column with a check icon, to the left of Tags, on both the Sessions page and the Agent page, plus a matching property on the session detail page. isTest is a new Session column replicated to ClickHouse sessions_v1. The playground action sets isTest instead of writing the tag, and a migration backfills existing sessions (isTest where the legacy tag is present) and removes the now-redundant tag.
1 parent 06969b2 commit 1984b34

14 files changed

Lines changed: 70 additions & 4 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: feature
4+
---
5+
6+
Agent sessions started from the Test playground are now flagged with a real `Session.isTest` boolean instead of a `"playground"` tag, surfaced as a dedicated "Test" column (check icon) in the Sessions table on both the Sessions and Agent pages, plus a matching property on the session detail page. Existing sessions are backfilled and the now-redundant tag is removed.

apps/webapp/app/components/sessions/v1/SessionsTable.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ArrowRightIcon } from "@heroicons/react/20/solid";
2+
import { CheckIcon } from "@heroicons/react/24/solid";
23
import { useLocation, useNavigation } from "@remix-run/react";
34
import { formatDuration } from "@trigger.dev/core/v3/utils/durations";
45
import { RunsIconExtraSmall } from "~/assets/icons/RunsIcon";
@@ -87,6 +88,7 @@ export function SessionsTable({
8788
</TableHeaderCell>
8889
<TableHeaderCell>Type</TableHeaderCell>
8990
<TableHeaderCell>Agent ID</TableHeaderCell>
91+
<TableHeaderCell>Test</TableHeaderCell>
9092
<TableHeaderCell>Tags</TableHeaderCell>
9193
<TableHeaderCell>Created</TableHeaderCell>
9294
<TableHeaderCell>Duration</TableHeaderCell>
@@ -97,7 +99,7 @@ export function SessionsTable({
9799
</TableHeader>
98100
<TableBody>
99101
{sessions.length === 0 ? (
100-
<TableBlankRow colSpan={8}>
102+
<TableBlankRow colSpan={9}>
101103
<div className="flex items-center justify-center">
102104
<Paragraph className="w-auto">
103105
{hasFilters
@@ -144,6 +146,13 @@ export function SessionsTable({
144146
<MiddleTruncate text={session.taskIdentifier} className="font-mono text-xs" />
145147
</div>
146148
</TableCell>
149+
<TableCell to={sessionPath}>
150+
{session.isTest ? (
151+
<CheckIcon className="size-4 text-charcoal-400 group-hover/table-row:text-text-bright" />
152+
) : (
153+
"–"
154+
)}
155+
</TableCell>
147156
<TableCell to={sessionPath}>
148157
{session.tags.length > 0 ? (
149158
<div className="flex flex-wrap gap-1">
@@ -168,7 +177,7 @@ export function SessionsTable({
168177
)}
169178
{isLoading && (
170179
<TableBlankRow
171-
colSpan={8}
180+
colSpan={9}
172181
className="absolute left-0 top-0 flex h-full w-full items-center justify-center gap-2 bg-charcoal-900/90"
173182
>
174183
<Spinner /> <span className="text-text-dimmed">Loading…</span>

apps/webapp/app/presenters/v3/SessionListPresenter.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export class SessionListPresenter {
221221
externalId: session.externalId,
222222
type: session.type,
223223
taskIdentifier: session.taskIdentifier,
224+
isTest: session.isTest,
224225
tags: session.tags ? [...session.tags].sort((a, b) => a.localeCompare(b)) : [],
225226
status,
226227
closedAt: session.closedAt ? session.closedAt.toISOString() : undefined,

apps/webapp/app/presenters/v3/SessionPresenter.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export class SessionPresenter {
170170
externalId: session.externalId,
171171
type: session.type,
172172
taskIdentifier: session.taskIdentifier,
173+
isTest: session.isTest,
173174
tags: session.tags ? [...session.tags].sort((a, b) => a.localeCompare(b)) : [],
174175
metadata: session.metadata,
175176
triggerConfig: session.triggerConfig,

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BoltIcon, BoltSlashIcon } from "@heroicons/react/20/solid";
2-
import { BookOpenIcon } from "@heroicons/react/24/solid";
2+
import { BookOpenIcon, CheckIcon } from "@heroicons/react/24/solid";
33
import { type MetaFunction } from "@remix-run/react";
44
import { type LoaderFunctionArgs } from "@remix-run/server-runtime";
55
import { useVirtualizer } from "@tanstack/react-virtual";
@@ -818,6 +818,16 @@ function OverviewTab({ session, status }: { session: LoadedSession; status: Sess
818818
<span className="font-mono text-sm">{session.taskIdentifier}</span>
819819
</Property.Value>
820820
</Property.Item>
821+
<Property.Item>
822+
<Property.Label>Test</Property.Label>
823+
<Property.Value>
824+
{session.isTest ? (
825+
<CheckIcon className="size-4 text-text-dimmed" />
826+
) : (
827+
<span className="text-text-dimmed"></span>
828+
)}
829+
</Property.Value>
830+
</Property.Item>
821831
{session.currentRun ? (
822832
<Property.Item>
823833
<Property.Label>Current run</Property.Label>

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.playground.action.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
161161
type: "chat.agent",
162162
taskIdentifier: agentSlug,
163163
triggerConfig: triggerConfig as unknown as Prisma.InputJsonValue,
164-
tags: ["playground"],
164+
// Mark as a Test session — surfaced via the Test column in the
165+
// Sessions table. Session tags stay empty; the triggered run still
166+
// carries "playground:true" via triggerConfig.tags.
167+
isTest: true,
165168
projectId: project.id,
166169
runtimeEnvironmentId: environment.id,
167170
environmentType: environment.type,

apps/webapp/app/services/sessionsReplicationService.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ function toSessionInsertArray(
802802
session.expiresAt ? session.expiresAt.getTime() : null,
803803
session.createdAt.getTime(),
804804
session.updatedAt.getTime(),
805+
session.isTest ?? false,
805806
version.toString(),
806807
isDeleted ? 1 : 0,
807808
];

apps/webapp/app/services/sessionsRepository/clickhouseSessionsRepository.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export class ClickHouseSessionsRepository implements ISessionsRepository {
9393
externalId: true,
9494
type: true,
9595
taskIdentifier: true,
96+
isTest: true,
9697
tags: true,
9798
metadata: true,
9899
closedAt: true,

apps/webapp/app/services/sessionsRepository/sessionsRepository.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export type ListedSession = Prisma.SessionGetPayload<{
8787
externalId: true;
8888
type: true;
8989
taskIdentifier: true;
90+
isTest: true;
9091
tags: true;
9192
metadata: true;
9293
closedAt: true;

apps/webapp/test/sessionsReplicationService.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ describe("SessionsReplicationService", () => {
8080
},
8181
tags: ["user:42", "plan:pro"],
8282
metadata: { plan: "pro", seats: 3 },
83+
isTest: true,
8384
},
8485
});
8586

@@ -108,6 +109,7 @@ describe("SessionsReplicationService", () => {
108109
environment_type: "DEVELOPMENT",
109110
task_identifier: "my-agent",
110111
tags: ["user:42", "plan:pro"],
112+
is_test: 1,
111113
_is_deleted: 0,
112114
})
113115
);

0 commit comments

Comments
 (0)