Skip to content

feat(site): add a Workflows panel to agent chats - #256

Merged
ibetitsmike merged 29 commits into
mainfrom
mike/workflows-ui-2-panel
Nov 12, 2026
Merged

ibetitsmike merged 29 commits into
mainfrom
mike/workflows-ui-2-panel

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Xum acted for @ibetitsmike: this PR was written and opened by an agent.

Chats in the fork-workflows experiment get a Workflows tab in the right panel. This is the second of three UI PRs for the experiment; the first rendered the workflow tool cards (#246), and the next adds a Stop control.

The tab appears only when the experiment is on, the viewer is an owner, the chat is a root chat, and the chat has at least one workflow run, so ordinary chats are unchanged. A failed run list request hides the tab.

The run list shows each run newest first: a status badge, the title (or the script preview, cut off with an ellipsis, when the run has none), when it started, how long it ran, step progress and failed step count. Clicking a run opens its detail: status, title, timing, step progress, run ID, a hint to ask the agent to resume an interrupted run, the run error, the step list linking each step to its child chat, the result, logs and script. A back button returns to the list.

Runs have no watch socket, so the list polls every 5 seconds while a run is running and every 30 seconds otherwise. The detail polls every 3 seconds while its run is running and the tab is visible. A failed refetch keeps the cached data and shows a warning.

The panel reads the run list and detail endpoints from #258 with their generated WorkflowRun and WorkflowRunDetail types, and reuses the status badge, step list and long text from components/ForkWorkflows/ (#246). The only upstream file touched is AgentChatPageView.tsx: two imports, one hook call and one conditional SidebarTab.

A nil json.RawMessage parameter is not a driver NULL: database/sql
converts it to a zero-length []byte, which lib/pq sends as an empty
string and Postgres rejects on a jsonb column (invalid input syntax
for type json). Route the three nullable jsonb params through
pqtype.NullRawMessage via sqlc column overrides and a jsonbValue
helper.
The run list, run detail and stop_workflow of a chat, as the API side
of the fork-workflows experiment:

- GET  /api/v2/chats/fork/{chat}/workflow-runs (keyset page, step counts)
- GET  /api/v2/chats/fork/{chat}/workflow-runs/{run} (script, steps,
  result and logs of the terminal snapshot)
- POST /api/v2/chats/fork/{chat}/workflow-runs/{run}/stop (409 terminal)

Every route is gated like the workflow tools: the fork-workflows
experiment and the chat owner's deployment owner role. The stop runs
through chatd.ForkStopWorkflowRun: a live run unwinds on a canceled
script context and journals stopped with a snapshot that carries the
failed open steps; a run this replica does not hold is stopped through
its journal rows.

A chatdmig node adds workflow_runs.updated_at/finished_at and
workflow_steps.started_at/finished_at, which the run status updates
stamp. The generated forkdb output, the apidoc swagger entries and
typesGenerated.ts are not in this commit yet.
…olumns

The sqlc.arg(...)::jsonb casts cut the params off from the column
overrides, so InsertWorkflowStepParams.Value and the Update* result and
value params generated as json.RawMessage and did not compile against
jsonbValue's pqtype.NullRawMessage. An uncast param keeps the override:
the generated param is NullRawMessage, which sends a real SQL NULL for
an empty document instead of the zero-length string Postgres rejects
on jsonb. The models already scanned NullRawMessage, so this completes
the same fix as the column overrides.
…s-2b-run-api

# Conflicts:
#	coderd/database/forkdb/queries/workflow_runs.sql
The merge of the jsonb param fix duplicated the method after
FailOpenWorkflowStepsOfRun; vet caught the redeclaration.
A resumed run returned journaled steps without setting reused, so the
await result showed reused false for steps the restart did not run
again. The journal read path already hardcodes reused for the same
reason.
…b-run-api

# Conflicts:
#	coderd/database/dbauthz/fork_forkdb.go
#	coderd/database/dbmetrics/fork_forkdb.go
#	coderd/database/forkdb/queries/workflow_runs.sql
#	coderd/database/forkdb/sqlc.yaml
#	coderd/x/chatd/fork_workflow.go
#	coderd/x/chatd/fork_workflow_journal.go
#	coderd/x/chatd/fork_workflow_journal_internal_test.go
…anel

# Conflicts:
#	coderd/x/chatd/fork_workflow.go
#	coderd/x/chatd/fork_workflow_journal_internal_test.go
@ibetitsmike
ibetitsmike marked this pull request as ready for review November 12, 2026 18:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T18:34:39.189046Z c1c40b0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c913639fc9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/forkWorkflows.ts Resolved
Comment thread site/src/api/queries/forkWorkflows.ts Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum acted for @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: c1c40b0ee5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike merged commit 1878b7c into main Nov 12, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/workflows-ui-2-panel branch November 12, 2026 18:56
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merged head c1c40b0ee5 as squash commit 1878b7c6c1. Gates on that head:

  • fork-ci run 43280462252: all 7 jobs passed.
  • Codex receipt 6832484970: no major issues on c1c40b0ee5, 0 unresolved threads. Of the 10 P2s from the auto-review, one was fixed (the heading for untitled runs) and nine were declined.
  • Ops UAT on :3100 passed 7/7 with screenshots. It covered tab gating, the run list against the API, the detail view with a nested result, a failed run, stopping a live run through the API, an interrupted run rejecting stop with 409, and page health.

Follow-ups: the Stop button comes in the next PR. The duration of an interrupted run keeps growing because the run has no finished_at.

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