Skip to content

refactor(coderd/x/chatd): drop the unused runnerCtx from the runner debug turn - #31010

Draft
ibetitsmike wants to merge 2 commits into
mike/chatdebug-drop-stale-indexesfrom
mike/chatdebug-drop-runner-ctx
Draft

ibetitsmike wants to merge 2 commits into
mike/chatdebug-drop-stale-indexesfrom
mike/chatdebug-drop-runner-ctx

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Deletes runnerDebugTurn.runnerCtx and the context parameter of newRunnerDebugTurn. The field's only reader was the LaunchRunHeartbeat call in ensureLocked, which #30988 deleted with the run heartbeats, so nothing has read it since.

Why it is safe: the constructor set the field and no code read it. The debug turn still uses the context of each call to Ensure, Context and Finalize, which this PR does not change. runner.go and 10 tests stop passing a context, and four of those tests drop the context.WithCancel that they created only for this parameter.

Validation:

  • go build ./coderd/x/chatd/... and go vet ./coderd/x/chatd/... pass.
  • The 25 chatd debug-run tests, TestRecordGenerationFinishFailure, TestSessionStartDispatchFailureFinishesGeneration and TestStartGeneration_CancelsDeletedToolCallsOnAgent pass under -race.
  • golangci-lint run --fix=false ./coderd/x/chatd/ reports 0 issues, and the pre-commit hook passed.

Stack

This stack deletes the stale debug-run sweep, then simplifies the chatdebug debug-run, stream wrapper and step numbering code, drops the indexes the sweep used, and last deletes a runner debug field that lost its only reader with the heartbeats. The debug-run and stream wrapper refactors each sit on a test-only layer that pins the behavior they keep.

  1. refactor(coderd): delete the chat debug run and step heartbeats #30988 Delete the chat debug run and step heartbeats
  2. refactor: delete chatdebug FinalizeStale and the stale threshold #30989 Delete FinalizeStale and the stale threshold
  3. refactor: delete the FinalizeStaleChatDebugRows query #30995 Delete the FinalizeStaleChatDebugRows query
  4. test(coderd/x/chatd): pin the debug runs that turns, titles and status labels record #30933 Pin the debug runs that turns, titles and status labels record
  5. refactor(coderd/x/chatd): create and finalize debug runs through one helper #30934 Create and finalize debug runs through one helper
  6. test(coderd/x/chatd/chatdebug): table the stream wrapper tests and cover their status rules #30980 Table the stream wrapper tests and cover their status rules
  7. refactor(coderd/x/chatd/chatdebug): share one finalize-once lifecycle between the stream wrappers #30981 Share one finalize-once lifecycle between the stream wrappers
  8. refactor(coderd): number chat debug steps in the database #31007 Number chat debug steps in the database
  9. refactor(coderd/x/chatd/chatdebug): delete the process-global step counters #31008 Delete the process-global step counters
  10. chore(coderd/database): drop the chat debug stale-sweep indexes #31009 Drop the chat debug stale-sweep indexes
  11. This PR: Drop the unused runnerCtx from the runner debug turn

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

…ebug turn

Deleting the run heartbeat left runnerDebugTurn.runnerCtx without a
reader. Delete the field and the context parameter of newRunnerDebugTurn.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T20:55:47.671459Z 9a00eae 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 4f2efc0a51

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

@codex review

Xum, an AI agent, requested this review for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9a00eaed71

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

This branch has not been deployed

No deployments
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