Skip to content

feat(chatd): journal workflow run args, step reuse and live logs - #341

Merged
ibetitsmike merged 50 commits into
mainfrom
mike/issue-324-run-detail-a
Nov 16, 2026
Merged

ibetitsmike merged 50 commits into
mainfrom
mike/issue-324-run-detail-a

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Coder Agents opened this PR on behalf of @ibetitsmike.

Part of #324 (items 2 and 5 of #226). The UI lands in a stacked PR on top of this one, which closes the issue.

The run detail endpoint now returns what a run did and what it is doing:

  • WorkflowRunDetail gains args, the JSON object main(args) received.
  • workflow_steps carries a reused flag. The engine journals it at start and on every replay, a resume of a terminal run marks its rows reused, and a chatdmig node backfills the flag from stored snapshots. The API reads the row instead of the hardcoded false.
  • A live run writes its log lines through to the journal as the script logs, capped to the last workflowLiveLogs lines, and the detail reads them while the run still runs. The terminal snapshot keeps precedence.

With fork-workflows off, nothing changes. Stop and resume behavior (#323) and phases (#325) are untouched.

Tests: chatd journal engine tests for live logs (write through while running, cap) and reuse journaling (fresh false, resume true, terminal-resume rows marked), a chatdmig backfill test against Postgres, dbauthz authorizer cases for the two new forkdb queries, and coderd route tests for args, reused and live logs in the detail.

The run detail endpoint now returns what a run did and what it is doing:

- WorkflowRunDetail gains args, the JSON object main(args) received.
- workflow_steps carries a reused flag. The engine journals it at start
  and on every replay, a resume of a terminal run marks its rows reused,
  and a chatdmig node backfills the flag from stored snapshots. The API
  reads the row instead of the hardcoded false.
- A live run writes its log lines through to the journal as the script
  logs, capped to the last workflowLiveLogs lines, and the detail reads
  them while the run still runs. The terminal snapshot keeps precedence.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-16T21:46:53.296098Z fe0bd52 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.

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

ℹ️ 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/typesGenerated.ts Resolved
Comment thread coderd/x/chatd/fork_workflow.go Resolved
Comment thread coderd/x/chatd/fork_workflow_journal.go Resolved
Comment thread coderd/x/chatd/fork_workflow.go Resolved
Comment thread coderd/x/chatd/fork_workflow.go Resolved
Review of #341 found that a log-heavy script wrote one journal row per
line, that a restart replay shortened the retained log lines to the
lines the replay printed so far, and that a replayed or reported step
could clobber its durable state:

- The log write-through paces itself. A run flushes at most once per
  workflowLogFlushInterval, a burst lands in one write, and finish
  lands the last burst before the run ends.
- A rehydrated run starts its logs from the journal column, so the
  first replayed line extends the retained tail instead of replacing
  it.
- The replay of a finished step flips only the reuse flag, through the
  new MarkWorkflowStepReused query, so status, value and finished_at
  stay as the journal holds them. The resume of a terminal run marks
  its steps through MarkWorkflowStepsReusedByRun, best effort.
- workflow_report keeps the reused flag of the row it records, so an
  accepted report of an already reused step cannot write false back.

Generated API artifacts follow the query changes.
…tail-a

# Conflicts:
#	coderd/database/forkdb/sqlc.yaml
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Addressed the first review in cdf2bbc and resolved the merge with main in dc97a4d:

  • P1, per-line journal writes: the log write-through now paces itself. A run flushes at most once per workflowLogFlushInterval, a burst lands in one write, and finish lands the last burst before the run ends. A loop that logs still writes at most one row per interval.
  • P2, replay shortens the retained logs: a rehydrated run now starts its logs from the journal column, so the first replayed line extends the retained tail instead of replacing it, and the terminal snapshot carries the pre-restart lines.
  • P2, replay clobbers the finished step: the replay of a finished step flips only the reuse flag through the new MarkWorkflowStepReused query, so status, value and finished_at stay. The resume of a terminal run marks its rows through MarkWorkflowStepsReusedByRun, best effort.
  • P2, orphan report clears reuse: workflow_report now keeps the reused flag of the row it records.
  • P2, generated args type: left as is. Args is a free-form JSON object on purpose, matching result and step value, which the same detail type already models as object. The UI reads it through formatForkWorkflowValue and not as a generated map, so no consumer casts.

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

ℹ️ 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 site/src/api/typesGenerated.ts Resolved
Comment thread coderd/x/chatd/fork_workflow.go Resolved
Second review round:

- The immediate log flush now marks itself in flight under journalMu, so
  the first burst cannot launch one goroutine per line and a slower older
  write cannot land after a newer one.
- The replay of a journaled step always flips only the reuse flag, open
  rows included. A report the child sent while the run was interrupted
  can land between the rehydration and the replay, and the full update
  would reset that row to running.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Second round, in 376e17b:

  • P1, in-flight marker: the immediate flush goroutine now takes an in-flight flag under journalMu before unlocking, so the first burst cannot start one flush per line and the writes stay serialized behind the seq check.
  • P2, open step reset: the replay of a journaled step now always flips only the reuse flag, open rows included. A report that landed between rehydration and replay keeps its status, value and finished_at.
  • P2, cancelled todo enum: the merge of main carried a lint pass that had renamed the enum in generated files only; I reverted those generated files on this branch, so the contract matches the server again. The Go enum change itself lives on the phases PR.

@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: 376e17bd21

ℹ️ 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/x/chatd/fork_workflow_journal.go Resolved
Comment thread coderd/x/chatd/fork_workflow_journal.go Resolved
A line appended while the immediate log flush is in flight dropped its
scheduling request, so it stayed unjournaled until the next log call or
the end of the run. The completed flush now re-arms one for pending
lines.

The replay of a restored run duplicated the retained pre-restart lines:
the restored baseline and the replayed echo both landed in the view and
the journal. appendLogLocked now suppresses the replayed lines that
still match the baseline and drops the baseline on the first diverging
line.

await_workflow for a run this replica does not hold now reports the
journaled live lines instead of an empty log.
The generated artifacts of the journal commit picked up a canceled
spelling for ChatTodoStatus that the server never had: swag collects
enum constants in map order, so the regenerated files drifted from the
source. This restores the enum to cancelled and reorders the
ChatContextResourceKind enum the way a fresh run of the generator in
this tree writes it, which check-apidoc sorts before comparing.
@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: e8c3a17e50

ℹ️ 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/x/chatd/fork_workflow.go Resolved
Review of the echo suppression found two more holes:

- The baseline held only the retained tail of a capped run, so a replay
  from the first line broke the match at once and dropped the tail. The
  suppression now tolerates a baseline that starts mid-stream: an
  unmatched prefix of the baseline never breaks the match, and the
  replayed lines the tail dropped append after it.
- Two overlapping flushes could still write out of order: the seq check
  ran before the write, so a stalled write of an older snapshot could
  replace newer lines. The callers now take a per-run write token before
  the check and release it after the write, and the SetWorkflowRunLogs
  query only replaces the column when the stored fork_seq is not ahead,
  so a stalled write is dropped on the database side as well.
@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: 7c6f410887

ℹ️ 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_workflow_runs.go Resolved
The logs column of a live run now holds the lines with their journal
sequence, but the route still decoded it as a plain array and failed
with a 500 for every running run that had logged. It decodes through
chatd.RestoreWorkflowRunLogs now, which also keeps the plain array of
the backfill readable.
Main gained the list_workflows tool (#338), so forkWorkflowTools now
returns three tools; the journal tests assert the new layout.
@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: f74970915d

ℹ️ 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 docs/reference/api/schemas.md Resolved
…ve logs

The capped-tail test resumed through the old fixture server, which
still held the run in its registry and returned it without a replay,
so the test passed without exercising the replay path. The resume now
goes through the restarted server.

The generated schema described logs as a terminal-snapshot field only;
the comment now says the lines are written through while the run runs,
and the artifacts follow.
The echo suppression broke on a capped baseline: the tail starts at
line 30 of a run that replayed from line 0, so the first comparison
failed and the suppression could drop or reorder the retained tail.
The replay now skips the lines the baseline does not name while the
match can still continue, keeps the journal writes off until the
replay has echoed the whole baseline, and hands back to live output
once the replay prints more unmatched lines than the baseline holds.
The terminal snapshot always writes the final lines.
…tail-a

# Conflicts:
#	coderd/database/forkdb/sqlc.yaml
…m and determinize the pacing tests

The engine log path now appends through its own locked helper, so the
echo credit cannot swallow an engine line and an engine line cannot
consume a replay echo. flushLogs reports its outcome, and only a missed
write token re-arms the fallback: a nothing-pending drop and the closing
flag of the end stop the rounds, so no timer outlives the run. The
pacing tests count flush attempts with an independent deadline instead
of sleeping, and every held write token goes through one helper that
cannot double send.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review head f9ac8b909e71dc975d33e4bc972f19d75f6580ea

Round 4 on top of df23315, one fix commit cba659e plus a merge of main f9ac8b9:

  1. Echo bypass (thread PRRT_kwDOVmG7O8635wOO): engine lines now go through appendLineLocked directly, so the echo credit cannot suppress them and they cannot spend a replay credit. Covered by TestForkWorkflowEngineLogBypass.
  2. Fallback re-arm (thread PRRT_kwDOVmG7O8635wOV): flushLogs now reports flushWrote, flushMissedToken or flushNothingPending. Only a missed token re-arms. A nothing-pending drop stops, and cancelLogFlush sets flushClosing so no timer outlives the run. Covered by FallbackStopsWhenNothingIsPending and NoFlushTimerAfterFinish.
  3. Pacing test (thread PRRT_kwDOVmG7O8635wOa): HeldTokenDoesNotSpin waits for the first attempt on an independent 10s deadline and asserts at most 2 further attempts in 300ms, no sleep-based assumption about the first attempt.
  4. ReplayKeepsARepeatedPrefix now waits for the tail content instead of a fixed sleep.
  5. All held write tokens go through holdJournalWriteToken, whose once-guarded release cannot double send.

Evidence: go test -race -count=1 ./coderd/x/chatd/ -run Workflow passes; TestForkWorkflowLiveLogs and TestForkWorkflowStop pass 10 times in a row with -race; TestForkWorkflowEngineLogBypass passes 5 times. The new tests fail against the df23315 production file (build or behavior failure), so they cover the fixes.

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

ℹ️ 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/x/chatd/fork_workflow_journal.go Resolved
Comment thread codersdk/fork_workflow_runs.go Resolved
…lush and describe the live-log write-through

The paced fallback timer stamps its attempt when it fires, on the write
and drop outcomes alike, so a line that lands right after a timer write
waits out the interval instead of writing back to back. The immediate
flush goroutine re-arms on every completed outcome, not only a write: a
line that lands while a flush is in flight no longer strands until the
next log call or the end of the run, and the nothing-pending re-check
keeps that from looping. NoFlushTimerAfterFinish now appends a late line
while the terminal flush waits for the held token, which fails when the
flushClosing checks are removed. TestForkWorkflowLogPacing pins one
write per interval across a timer write followed by a new line, and it
fails against the f9ac8b9 timer. The Fork-workflows runs note of the
chatd architecture document describes the live-log write-through, its
pacing, retention cap and replay, and the workflow run detail marks its
args and result as arbitrary JSON in OpenAPI.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review head e194a693fb4db15cc8334ed42f070fc17ea7d9ed

Round 5, one commit e194a69 on top of f9ac8b9:

  1. Timer stamp (thread 4586821148): the paced fallback timer stamps lastLogFlush when it fires, on the write and drop outcomes alike, so a line after a timer write paces to the next interval. TestForkWorkflowLogPacing pins it and fails against f9ac8b9 (its timer never stamps).
  2. Architecture prose (thread 4586821161): final prose in the Fork-workflows runs note of coderd/x/chatd/ARCHITECTURE.md covering the live-log write-through, pacing, the 50-line/64KiB/4KiB caps and replay, numbers checked against the code. No TODO added.
  3. OpenAPI args (thread 4586821170): swaggertype:"object" on Args and Result in codersdk/fork_workflow_runs.go, matching the existing RawMessage pattern in codersdk (audit.go, oauth2.go). Regenerated typesGenerated.ts; the generated diff is limited to the args doc comment and type.
  4. Older 11:35Z threads (4585211342 echo bypass, 4585211355 fallback timers, 4585211362 pacing sync): all three are fixed by cba659e, replied and resolved.
  5. Opus delta P3s: rearmLogFlush now runs on every completed flush outcome (token miss excepted), NoFlushTimerAfterFinish appends a late line during the terminal wait (fails with the flushClosing checks removed), the lastLogFlush comment lists the paths that actually stamp it, and the re-take comment in TerminalFlushWaitsForAnInFlightWriter now credits the sync.Once.

Evidence: go test -race -count=1 ./coderd/x/chatd/ -run Workflow passes; TestForkWorkflowLiveLogs, TestForkWorkflowStop and TestForkWorkflowLogPacing pass 10 times with -race; gofmt and go vet clean.

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

ℹ️ 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 codersdk/fork_workflow_runs.go Resolved
Comment thread codersdk/fork_workflow_runs.go Resolved
…a and close the round-6 review findings

Round 6 of the run-detail review on PR #341:

- WorkflowRunDetail.Args and Result lose json.RawMessage and the
  swaggertype tag: swag renders any as an unconstrained schema, which
  is what an args value is, so the OpenAPI no longer claims an object.
  Args keeps no omitempty: the column is non-null and every response
  sets it. The route tests marshal the fields before JSONEq.
- TimerWritePacesTheNextLine no longer re-takes the write token: the
  token stays free after the timer write, so the stamp alone paces the
  next line, and the sub-test observes the journal instead of a fixed
  sleep window. It fails on the pre-round-5 code for the stale-stamp
  reason. SustainedLoggingWritesOncePerInterval states what it counts
  and bounds the attempts per elapsed interval instead of a fixed
  window, so a slow runner cannot trip it.
- NoFlushTimerAfterFinish logs the late line through run.log, so the
  scheduleLogFlush attempt is covered too, and the mutation proof with
  the closing guards disabled fails on the attempts leak.
- The lastLogFlush field comment and the ARCHITECTURE live-logs note
  name exactly the two paths that stamp the attempt, say that replay
  suppression is by count, and that a journaled failed step re-emits
  its failure line through the counted path.
- Both new chatdmig node files end in a newline; TestUpgradeMatchesFresh
  passes.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

New head: 6c85139. Round 6: args and result are any, the pacing and closing tests are load-bearing with mutation proofs, the stamp comments are exact, and both new migration nodes end in a newline.

The 01a1d05b node ran on the production database already, so its
checksum in the chatdmig ledger is immutable: a newline would make
NewRunner refuse to start with the node changed after it ran. Only
01a1e3a6, the run-detail node new in this PR, keeps the trailing
newline.

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

ℹ️ 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 codersdk/fork_workflow_runs.go Resolved
Comment thread coderd/x/chatd/fork_workflow_journal.go Resolved
Comment thread docs/reference/api/schemas.md Resolved
The run detail of a failed or stopped run stored the JSON null literal
of the snapshot in Result, so the response carried a present
"result": null. The raw bytes of a JSON null are four characters, so
the guard compares against that literal too. A route test now pins
that a failed run omits the result key.

The pacing test no longer depends on wall clock between ticks: it
sleeps one half interval, asserts the journal still holds two lines,
then waits for the third. Its mutation proof fails at the timer
stamp.

The Args and Result field comments note that the Go client decodes
numbers as float64, and the API docs and TS types are regenerated.
The mock run detail of the UI test helper carries args, which the
type check needs since args lost its omitempty.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

Round 7 head: b3d4d0b

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

ℹ️ 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_workflow_runs.go Resolved
- codersdk: WorkflowRunDetail.UnmarshalJSON decodes Args and Result from
  the raw JSON when present, so large integers keep exact values instead
  of rounding through float64.
- coderd: the result guard keeps only non-empty snapshots, so a failed or
  stopped run never gains a result key and a completed run keeps its
  value, including the encoded null of a script whose main returned None.
- chatd: log flush timing moves onto r.p.clock (quartz), so the pacing
  tests run on a mock clock with no wall-time sleeps.
- chatd: NoFlushTimerAfterFinish accepts either correct terminal failure
  line (the stop reason or the no-report failure) and prints the logs it
  last saw if the terminal flush never carries them.
- regen: apidoc, schemas.md, typesGenerated.ts; the Experiment enum order
  matches main again.
- tests: CompletedNoneReturnsNull, FailedRunHasNoResultKey omits the key,
  TestWorkflowRunDetailUnmarshalExactNumbers, mock-clock pacing tests.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

Round 8 head: 650911a

@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: 650911a23a

ℹ️ 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 codersdk/fork_workflow_runs.go Resolved
Journal the args bytes the caller sent instead of re-encoding the
decoded Args, so a number outside the float64 exact range reaches
main(args) unrounded. Test with 9007199254740993.

NoFlushTimerAfterFinish: wait for the step to be open before stop,
drop the impossible no-report candidate, wait with testutil.Eventually
and stamp with the run clock. Pin the pacing comment to the mock
clock. Tag the quartz flush Now reads and the timer Stop with
chatd and workflow_log_flush. Reword the args and result doc text
and restore the origin/main enum order in the generated docs.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Round 9, head 1c4042b.

For the Codex thread on inline args rounding: fixed rather than reworded. startWorkflowRun now prefers args.rawArgs, the args bytes exactly as the model sent them, when journaling, so main(args) and the run detail read the same value; marshaling args.Args stays the fallback. Covers the 9007199254740993 case with TestForkWorkflowInlineArgsExact (commit 1c4042b). Also in this round: NoFlushTimerAfterFinish waits for the step to be open before stop, drops the impossible no-report candidate, and waits with testutil.Eventually on the run clock; the quartz flush Now reads and the timer Stop are tagged chatd, workflow_log_flush; the args and result docs no longer name UnmarshalJSON; the generated enum order is back to origin/main and check-apidoc passes.

@codex review this head please.

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

ℹ️ 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 codersdk/fork_workflow_runs.go Resolved
Comment thread site/src/api/typesGenerated.ts Resolved
Comment thread site/src/testHelpers/forkWorkflows.ts Resolved
Restore the files a lint run reformatted to their round 8 content and
keep only the pacing comment fix. No lint flag was used.
A raw null in the args field journals as the empty object again, so
main(args) receives a dict and not None; rawArgs is used only when the
decode produced a value. InlineArgsExact drives the run_workflow tool
handler, so the rawArgs capture is under test. NullArgs covers the
inline and saved paths. The codersdk absent-key tests assert the field
is nil directly and that a re-marshal keeps the key absent, and they
fail with the raw guards removed. The paced flush timer arms with the
chatd and workflow_log_flush tags, which quartz v0.3 accepts after fn.
NoFlushTimerAfterFinish logs the logs it saw from inside the
eventually. The docs generator refreshed schemas.md, typesGenerated.ts
and the fixture args.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Round 10, head fe0bd52.

All three Codex threads from 1c4042b are fixed, plus five findings from our own round review:

  • Null args: startWorkflowRun now journals rawArgs only when the decode produced a value (args.Args != nil), so a literal null journals as {} and main(args) receives a dict, matching the pre-rawArgs behavior. TestForkWorkflowNullArgs covers the inline and saved paths (commit fe0bd52).
  • schemas.md: regenerated with the real docs generator (make -B coderd/apidoc/.gen). The WorkflowRunDetail section now has the args row, the "args": null example, result typed any, and the current logs/result text; chats.md and the enum blocks stay as main has them. check-apidoc passes.
  • typesGenerated.ts: regenerated, the two "decode without rounding: see UnmarshalJSON" comments are gone.
  • forkWorkflows.ts: the detail fixture uses MockForkWorkflowArgs.
  • InlineArgsExact now drives the run_workflow tool handler, and fails when the rawArgs capture is removed (mutation-proven).
  • NullArgs is mutation-proven too (fails when the guard reverts to len>0 only).
  • The codersdk absent-key tests assert the field is nil directly and that a re-marshal keeps the key absent; both fail with the raw guards removed.
  • The paced flush timer arms with the chatd and workflow_log_flush tags (quartz v0.3 accepts tags after fn); NoFlushTimerAfterFinish logs the logs it saw from inside the eventually.

@codex review this head please.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: fe0bd52780

ℹ️ 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 0f391d6 into main Nov 16, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/issue-324-run-detail-a branch November 16, 2026 21:59
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Merged as 0f391d6 (squash, --match-head-commit fe0bd5278050a3609168f9e8c6f709d6ce3b84eb).

Gates on head fe0bd52:

  1. Head SHA verified from gh pr view before the merge.
  2. All 9 check runs passed on that head (site, graph, forkdb, build, schema, agent-sdk, chat-tests, quiet x2). fork-ci run 43962833821 passed on that exact head. The chat-tests log has no FAIL or race.
  3. Codex receipt 6930364157: "Didn't find any major issues", Reviewed commit fe0bd52780.
  4. 0 of 51 review threads unresolved.
  5. Not behind main (3a63653, deployed as v2.39.4-devel+3a636533cf before the merge).
  6. Test evidence (independent Opus review in a detached worktree, all Go under one lock):
    • go test -race -count=1 -run Workflow ./coderd/x/chatd/: ok.
    • -race -count=20 LiveLogs, Stop and LogPacing: 480 PASS, 0 FAIL.
    • -race -cpu 2 -count=20 NoFlushTimerAfterFinish: 40 PASS.
    • codersdk TestWorkflowRunDetail*, coderd TestForkWorkflowRunsRoutes (7 PASS), chatdmig with a real Postgres (76 PASS, including TestUpgradeMatchesFresh), check-apidoc.sh exit 0, site tsc -p . exit 0.
    • Mutation checks: the null-args, inline exact-args, SDK decode and flush-closing fixes each fail their tests when reverted.
    • Ledger check: a database migrated at main accepts this branch's nodes, so the deployed node checksums are unchanged.

Not exercised: a live run on the dev server (live logs in the run detail page, stop from the UI, restart replay). The UI half of #324 follows in a separate PR.

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