Skip to content

fix(chatd): saved workflow polish from the #338 review - #383

Merged
ibetitsmike merged 7 commits into
mainfrom
mike/issue-352-saved-workflow-polish
Nov 17, 2026
Merged

ibetitsmike merged 7 commits into
mainfrom
mike/issue-352-saved-workflow-polish

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Coder Agents opened this PR on behalf of @ibetitsmike.

Closes #352

What changed and why

Small follow-ups from the review of #338 (saved workflows), each confirmed against current main after #379 and #380:

  • listWorkflowsDescription now says "the organization workflows that you can read" instead of "shared with you", which is also true for org admins and auditors.
  • validateSavedWorkflowArgs: the comment now says the out-of-range number check runs on the raw input while the schema check validates the re-marshaled args. rejectOutOfRangeNumbers takes the subject wording, so the args path says "the args contain" where the report path says "the report contains".
  • run_workflow: the script field description says "Send this, script_path or name." and the empty-input error says "script is required: send script, script_path or the name of a saved workflow".
  • Saved workflow descriptions get the same hidden-character rule as phase names (NUL, invalid UTF-8, control, Unicode format characters), reusing chatd.ValidateWorkflowPhaseName, on create and update in both route files.
  • run_workflow caps args at 64 KiB, the script cap, for inline and named runs alike, checked on the raw input bytes in the tool path and the marshaled value on the direct path. The tool description lists the cap next to the other limits.
  • ARCHITECTURE.md: the saved-workflows section states the description rule and that phase names and descriptions reject control and Unicode format (Cf) characters, and the tool list states the args cap. Final prose, no TODOs added.

How it was tested

All Go commands ran under flock ~/.fork-go.lock:

  • go build ./coderd/... and go build ./... pass.
  • go test -count=1 ./coderd/x/chatd/... passes, all 21 packages.
  • go test -count=1 -v -run 'SavedWorkflow|Workflow' ./coderd/x/chatd/ passes, 29 top-level tests.
  • go test -count=1 -run 'TestForkUserSavedWorkflows|TestForkOrganizationSavedWorkflows' ./coderd/ passes.
  • New tests: a description with a bidi or zero-width character is rejected on create and update (coderd/fork_saved_workflows_test.go), args over 64 KiB are rejected for inline and named runs (TestForkWorkflowLimit/ArgsSize, ArgsSizeByName), a resume after an edit or delete of the saved workflow replays the journaled script (TestForkSavedWorkflowTools/ResumeUsesJournaledScript/{Edit,Delete}), and an org admin subject sees a private organization workflow in list_workflows while a plain member does not (TestForkSavedWorkflowsOrgAdminListsPrivate).
  • golangci-lint run and paralleltestctx show no new findings on the changed files; TestForkPluginPackEnablement fails in the full ./coderd/ run on clean main too (context deadline under load) and passes when run alone, so it is a pre-existing flake unrelated to this PR.

Stays behind the fork-workflows experiment. No migration, no site/ changes.

Reword the list_workflows description so it is true for org admins and
auditors, fix the validateSavedWorkflowArgs comment and say "args" in
the args-path out-of-range number error, mention "name" in the script
field description and the empty-input error, reject hidden characters in
saved workflow descriptions with the phase-name rule, cap run args at
64 KiB like the script, and document the phase-name Cf rule and the args
cap in ARCHITECTURE.md.

Tests: a description with a bidi or zero-width character is rejected on
create and update, args over 64 KiB are rejected for inline and named
runs, a resume after an edit or delete of the saved workflow replays the
journaled script, and an org admin subject sees a private organization
workflow in list_workflows while a plain member does not.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-17T20:52:24.602475Z 7bff294 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: fafb41e3b6

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

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: fafb41e3b6

ℹ️ 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".

The cap ran before the journal lookup, so a journaled run with larger
args from an older version could not replay after a restart. Move the
check after the journal lookup and drop the stale comment claim that a
resumed run passes through it.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Update after the Codex review of fafb41e:

  • Fixed (P2, real regression): the 64 KiB args cap ran before the journal lookup, so a journaled run with larger args from an older version could not replay after a restart. Commit d07cf8b moves the check after the journal lookup so it applies only to fresh runs. All chatd tests pass with the change.
  • Dropped (P2, not a regression): validating stored descriptions of workflows saved before this change. Pre-existing behavior, and issue chatd: saved workflow polish from the #338 review #352 scopes this PR to no migration. The read boundary is a fair follow-up, noted on the issue.

New head: d07cf8bf4707438a9455f91a5f4d1e514be89184. Waiting on checks and a fresh Codex receipt for that head before this is merge-ready.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d07cf8bf47

ℹ️ 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

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Merged origin/main (b25a79b, #382 view_image follow-ups) into the branch. No conflicts; the merge touched only files #382 owns. Build and all chatd tests pass on the merge commit. New head: e97d257, so checks and the Codex receipt below now apply to the previous head only.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: e97d257c2a

ℹ️ 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".

The description check reused the phase-name rule, which rejects every
control character, so a multi-line description with a newline or tab
got 400 where main accepted it. Add chatd.ValidateWorkflowDescription,
which keeps the phase-name rule but allows \\n, \\r and \\t, and use it
for the create and update paths.

Also fix two review gaps: list_workflows lists the organization
workflows that the owner can read, not the ones shared with the owner,
and the script_path description mentions name.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Fixes from the lead review of e97d257, one commit 5a1cb79:

  1. Regression fixed: the saved-workflow description check reused the phase-name rule, which rejected every control character, so a description with a newline or tab got 400. New chatd.ValidateWorkflowDescription keeps the rule but allows \n, \r and \t; bidi overrides, zero-width and other control or format characters stay rejected. Tests: a multi-line description with a tab is accepted on create and update; U+202E and U+200B descriptions are rejected on update. The ARCHITECTURE.md sentence now says line breaks and tabs are allowed.
  2. The fork-workflows bullet now says list_workflows lists the organization workflows that the owner can read.
  3. The script_path description now says "Send this, script or name."

New head: 5a1cb79. A fresh Codex receipt for this head follows.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@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: 5a1cb79d24

ℹ️ 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/fork_saved_workflows.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

Re-requesting a review of head 5a1cb79. The one P2 finding from the last review of this commit (U+FFFD normalization of an invalid UTF-8 byte by the shared request decoder) was answered and its thread resolved; nothing is open.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 5a1cb79d24

ℹ️ 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".

make gen on the merge commit reorders the fork experiment keys in the
generated swagger to the order codersdk declares them and refreshes
mise.lock for the pnpm platforms the lockfile tool now records.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

Reviewing head 5f0a277, which merges origin/main (the upstream sync) into the branch and regenerates the API docs. The one P2 from the earlier review of 5a1cb79 (U+FFFD normalization by the shared request decoder) was answered and its thread resolved; nothing is open.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 5f0a277a3a

ℹ️ 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".

The mise.lock hunk in the regeneration commit came from installing helm
through mise in this workspace, not from make gen. Revert it.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

Reviewing head 7bff294, which only restores mise.lock to main; the mise.lock hunk in the previous commit came from a local tool install, not from make gen. No Go changes since 5f0a277, which was reviewed clean.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 7bff294ad7

ℹ️ 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 f05d9a1 into main Nov 17, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/issue-352-saved-workflow-polish branch November 17, 2026 21:11
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Merged at head 7bff294ad7b1265867061d069fb516b8fe08c17d as f05d9a1, on main 15ace5bfc789329d63cac5d77e10694d520e2ec0, with the server running that main.

Gates on this exact head:

  1. The head matched the SHA I verified (--match-head-commit).
  2. Every check run passed. fork-ci run 44173348462 passed on this head.
  3. Codex receipt for this head: fix(chatd): saved workflow polish from the #338 review #383 (comment) ("Didn't find any major issues").
  4. No unresolved review thread.
  5. 0 commits behind main.
  6. I ran the tests below.

Tests I ran on 5f0a277a3a (detached worktree, under flock ~/.fork-go.lock). The only change from that commit to the head is the restore of mise.lock to main, so no Go file differs:

  • go test -count=1 -v -run 'TestForkUserSavedWorkflows|TestForkOrganizationSavedWorkflows' ./coderd/: 10 PASS, 0 FAIL.
  • go test -count=1 -race -v -run 'SavedWorkflow|Workflow' ./coderd/x/chatd/: 177 PASS, 0 FAIL.
  • go test -count=1 ./coderd/x/chatd/...: 21 packages ok.
  • Negative control: with ValidateWorkflowDescription returning nil, TestForkUserSavedWorkflows/Enabled fails. The source was restored after it.

Review notes:

  • Fixed: a description may hold line breaks and tabs again. chatd.ValidateWorkflowDescription rejects bidi overrides, zero-width and other control or format characters, on create and on update.
  • Fixed: ARCHITECTURE.md says the listed workflows are the ones the owner can read, and the ScriptPath description names name.
  • The merge of main regenerated the API docs: the fork experiment keys and ChatContextResourceKind follow the order the generator gives on this tree. A mise.lock hunk from a local tool install was removed.
  • Declined Codex P2: invalid UTF-8 in a request body becomes U+FFFD in the shared JSON decode before the handler sees it. That is the decoder used by every coderd endpoint, not a regression of this PR.
  • Accepted nits: an import regroup in fork_workflow_report.go and the exported ValidateWorkflowPhaseName alias.
  • Stays behind fork-workflows.

Not exercised: a live saved workflow run started by name from a chat on a deployed server.

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.

chatd: saved workflow polish from the #338 review

1 participant