Skip to content

fix(coderd): stop the chat todo watcher quietly when its client leaves - #105

Merged
ibetitsmike merged 1 commit into
mainfrom
mike/fork-chat-todos-watch-ctx
Nov 10, 2026
Merged

ibetitsmike merged 1 commit into
mainfrom
mike/fork-chat-todos-watch-ctx

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Follow-up to #87's watcher in coderd/fork_chat_todos.go. When a browser closes the chat page while a change event or resync tick is pending, the loop wakes, the todo read fails with context canceled, and the watcher logs it at Error before looping back to exit. The daily server logged two such coderd.chat_todos_watcher errors from closed chat pages.

On a read error the loop now returns when the request context is done. Real database errors still log at Error.

No new test: reproducing the race needs the request context canceled between the wake-up and the read, which the existing watcher tests cannot do without a fault-injecting store. The existing TestForkChatTodos* tests pass.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 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-10T04:15:41.132334Z c908133 PR opened
ℹ️ 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

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (6ae89b1c7f) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (6ae89b1c7f), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (bfac64b730) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (bfac64b730), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (5decda1a92) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (5decda1a92), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (175f2a7aa9) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (175f2a7aa9), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike
ibetitsmike merged commit 24fcb84 into main Nov 10, 2026
54 of 82 checks passed
@ibetitsmike
ibetitsmike deleted the mike/fork-chat-todos-watch-ctx branch November 10, 2026 07:39
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence for head c90813324dbb75cf19cc17903a360d992ac2d32c:

  • fork-ci pull_request run 42774451827 passed; its build job checked out Merge c90813324d into 175f2a7aa9 (current main). All checks green. Run 42754504872 had also passed on this head.
  • Codex code review completed on this exact head with no findings (summary comment 6758789676, plus the bot's +1). 0 unresolved review threads. Merge state CLEAN.
  • One file, coderd/fork_chat_todos.go: when the todo list read after a wake-up fails because the client left (ctx.Err() != nil), the watcher returns without logging; real database errors still log at Error and continue. No new test: reproducing the race needs the request context canceled between the wake-up and the read, which takes a fault-injecting store. TestForkChatTodos* pass against real Postgres. No UAT; after deploy, the context-canceled chat_todos_watcher Error lines should stop.

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