Title: chatd can initiate tool calls via dispatch hooks while another such process is already ongoing · Issue #30316 · coder/coder · GitHub
Open Graph Title: chatd can initiate tool calls via dispatch hooks while another such process is already ongoing · Issue #30316 · coder/coder
X Title: chatd can initiate tool calls via dispatch hooks while another such process is already ongoing · Issue #30316 · coder/coder
Description: IIUC when the model emits tool calls for client-provided tools, chatd record that and moves the chat to requires_action. The client side observes this through the chat stream, runs the tools itself, and calls SubmitToolResults. The handl...
Open Graph Description: IIUC when the model emits tool calls for client-provided tools, chatd record that and moves the chat to requires_action. The client side observes this through the chat stream, runs the tools itself...
X Description: IIUC when the model emits tool calls for client-provided tools, chatd record that and moves the chat to requires_action. The client side observes this through the chat stream, runs the tools itself...
Opengraph URL: https://github.com/coder/coder/issues/30316
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"chatd can initiate tool calls via dispatch hooks while another such process is already ongoing","articleBody":"IIUC when the model emits tool calls for client-provided tools, chatd record that and moves the chat to `requires_action`. The client side observes this through the chat stream, runs the tools itself, and calls `SubmitToolResults`. \n\nThe handler for the submission runs three steps: \n- a read that checks the chat is still requires_action and resolves the pending tool-call IDs (a lock-free snapshot after #30266)\n- an outbound HTTP call to any admin-configured hooks (EventPostToolUse) outside any transaction, and \n- a CompleteRequiresAction transition under the chat's exclusive row lock that records the results and returns to running. \n\nCurrently two concurrent submissions (a client retry, two tabs) for the tool work can both pass the read check for `requires_action`, both call the hooks, and then the second fails at commit since we check there that the status is still `requires_action`, so external hook side effects fire for results that were never accepted.\n\nTo resolve this, rather than holding a lock across the hook call, we could add an intermediate status `processing_results`. \n\n`SubmitToolResults` first takes the row lock, does some validation and then flips `requires_action` -> `processing_results` and commits; then calls the hooks; then commits the results with `processing_results` -> `running`. \n\nA second submission finds `processing_results` and is rejected before any hook fires. If the hook call fails, the request releases the claim back to `requires_action` so the client can resubmit. Additionally we could handle the server dying mid-claim; a claimed-at timestamp plus a timeout (handled by the existing `requires_action_timeout` task, which would also need to own `processing_results` chats) either releases the claim or cancels the action, as the existing `requires_action_deadline_at` does today; it must not re-fire the hooks.\n\ncc @hugodutka @ethanndickson ","author":{"url":"https://github.com/cstyan","@type":"Person","name":"cstyan"},"datePublished":"2026-10-03T00:13:21Z","url":"https://github.com/coder/coder/issues/30316"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:63d24119-c4c1-13a5-a876-04c845afc470 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC9C:2A7C1C:447368:5A5781:6B01976B |
| html-safe-nonce | 6c795ce6f66ad970cba9d73fc7c4de4fea7ffb812a1f0b19b7eb7b6a5d277706 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzlDOjJBN0MxQzo0NDczNjg6NUE1NzgxOjZCMDE5NzZCIiwidmlzaXRvcl9pZCI6IjgzODI1NTQwOTkzNjI2NjYzNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1837d90c76a6d5356878361834a93e8811b5dad36b03fe83e6faf970cc17761d |
| hovercard-subject-tag | issue:5684996457 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/30316/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0b595cdda18ea3d782a55e73ce71c6dea659fb5b9c1d1f526ea5b31e6889cf5c/coder/coder/issues/30316 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0b595cdda18ea3d782a55e73ce71c6dea659fb5b9c1d1f526ea5b31e6889cf5c/coder/coder/issues/30316 |
| og:image:alt | IIUC when the model emits tool calls for client-provided tools, chatd record that and moves the chat to requires_action. The client side observes this through the chat stream, runs the tools itself... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cstyan |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width