Skip to content

feat: add workflow report tool and step plumbing behind fork-workflows - #228

Merged
ibetitsmike merged 13 commits into
mainfrom
mike/chat-workflows-1-engine
Nov 12, 2026
Merged

ibetitsmike merged 13 commits into
mainfrom
mike/chat-workflows-1-engine

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Part of #226. First PR of the chat-workflows stack: the workflow_report server tool and the step-chat plumbing that the later Starlark-run PRs build on, behind the new fork-workflows experiment. With the flag off, chatd behaves exactly like upstream. The Starlark runtime, run lifecycle, and the run_workflow / await_workflow tools follow in the next stack PR.

What this adds

  • codersdk.ExperimentForkWorkflows (fork-workflows), a user-scoped experiment wired through the fork's p.experiments convention.
  • fork_workflow_report.go: the workflow_report server tool with strict schema validation, the per-step tool gating for step chats, and forkStopAfterWorkflowReport, which ends a step chat's turn once it has reported (hooked into the existing forkStopAfterTools fork hook).
  • fork_workflow_step.go: deterministic workflow and step IDs (SHA-1 over the call ID / step spec), the step spec and key types, and createWorkflowStepChat, which reuses the step's existing child chat when a run is resumed instead of creating a duplicate.
  • One hook per hot upstream file: subagent_operations.go gains a single fork *forkChildChatOverrides field plus a one-line call change (opts.forkCreate(...)), so fork code can override child-chat options; turn_environment.go keeps the report tool available to explore-type steps; chatd.go, chatstate/synthetics.go, and tasks.go skip dynamic tool-name parsing for the report tool since chatd serves it.
  • Tests: TestForkWorkflowReport and TestForkWorkflowStepChat (create vs reuse, deterministic IDs, default report schema, malformed report rejected).

Differences from the upstream prototype this ports (coder#31189)

  • Experiment gating follows the fork convention (p.experiments, fork-workflows) instead of upstream's user-scoped experiment, and tool gating moves into appendForkTools.
  • Files are named fork_workflow_*.go with fork headers; symbol names are kept identical to the prototype for a mechanical diff.
  • Upstream's withWorkflowReportStop becomes forkStopAfterWorkflowReport(stop, chat) reading chat.DynamicTools, called from the existing forkStopAfterTools hook.
  • Child-chat overrides enter childSubagentChatOptions as one fork field plus one changed call line, rather than the prototype's three new fields and three read sites.
  • The deterministic step chat ID is selected before the prompt-review hook call, so lifecycle hook events carry the chat ID the step chat is persisted with.
  • The in-memory run registry and lifecycle counting arrive with the Starlark runtime PR.

Xum opened this PR on behalf of @ibetitsmike.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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-12T07:53:10.415957Z d039392 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: 9d1d0c7506

ℹ️ 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 coderd/x/chatd/chatd.go Resolved
Comment thread coderd/x/chatd/subagent_operations.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread codersdk/fork_experiments.go Resolved
Comment thread coderd/x/chatd/fork_workflow_step.go Resolved
…i docs

Addresses the Codex review of #228:

- The workflow_report reservation (tool injection, turn stop, dynamic
  tool parsing) now gates on chatIsWorkflowStep: a child chat carrying
  the fork's run label, which no caller-supplied path can set. Chats the
  fork did not create keep the upstream client-side behavior for
  caller-supplied dynamic tools of that name, with the experiment off or
  on. chatd.parseDynamicToolNames is upstream again; the chat-aware call
  sites apply the step filter.
- The deterministic step chat ID is selected before the user prompt
  hooks dispatch, so hook events carry the chat ID the step chat is
  persisted with and consumers can correlate them.
- The report tool's parameter shape inlines local $refs, so schemas
  using $defs reach the provider without dangling references; refs that
  cannot inline faithfully (remote, sibling keywords, recursion) are
  refused at step creation.
- Regenerate the public experiment enum with fork-workflows:
  coderd/apidoc docs and swagger, site/src/api/typesGenerated.ts,
  docs/reference/api/schemas.md.
- Add fork-workflows TODOs to the chatd architecture document for the
  affected child-creation and tool sections.

Part of #226
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: fd0008a75c

ℹ️ 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 coderd/x/chatd/ARCHITECTURE.md Resolved
Comment thread coderd/apidoc/swagger.json Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_step.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Round-2 review and CI fixes for the fork-workflows step plumbing:

- inline step refs before resolving the schema, so a remote reference is
  refused by the ref policy instead of surfacing the resolver's missing
  loader error (TestForkWorkflowReport/RejectsUninlinableRefs)
- copy const, default, enum and examples values verbatim while inlining:
  a ref-shaped object inside them is data, not a schema
- reject plan-mode changes on workflow step chats (PATCH and message
  send), whose system prompt requires the workflow_report server tool
  that plan-mode turns filter out
- reserve the coder_workflow_run label: a step chat's label update must
  keep its current value and no other chat may claim it
- align the fork-workflows x-enum-descriptions entry with its enum value
  in docs.go and swagger.json
- put each workflow TODO in ARCHITECTURE.md on its own line
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: 6a520a83fe

ℹ️ 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 coderd/x/chatd/fork_workflow_step.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_step.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: be8555f3f8

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: 3665fbd384

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: 1b95ff34a0

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: e6673c55f9

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: 9b10646647

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: 06840df3b8

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: 2ada86307c

ℹ️ 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 coderd/x/chatd/ARCHITECTURE.md Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_report.go Resolved
Comment thread coderd/x/chatd/fork_workflow_step.go Resolved
…ses, and lock step chats against owner edits
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@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: d039392c70

ℹ️ 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 coderd/x/chatd/fork_workflow_report.go Resolved
@ibetitsmike
ibetitsmike merged commit 5b0c0c3 into main Nov 12, 2026
9 checks passed
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merge evidence for head d039392c701ee7307f84ae07266030e613b5b827:

  • fork-ci run 43176808208 passed on this head, merged with main fcd3d209a8. All checks on the head pass.
  • Codex review 5870945380 is on this head. Its single P2 finding, a root report property named after a schema keyword, was dropped as an edge case and the thread is resolved. 36 threads, 0 unresolved.
  • No live UAT: this PR is dormant plumbing behind the fork-workflows experiment. No step chats are created until the workflow registry PR lands, and the API refuses to forge the run label. Coverage comes from the chatd integration tests (TestForkWorkflow*) and TestForkWorkflowStepChatImmutability. Live UAT with a real chat is planned for the next stack PR.
  • The ARCHITECTURE.md change adds only 2 TODOs for @ibetitsmike to write.

@ibetitsmike
ibetitsmike deleted the mike/chat-workflows-1-engine branch November 12, 2026 07:58
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