Repository navigation
fix(chat): register permission prompts before slow broker work - #84
Merged
Merged
Conversation
Permission hooks used a 200 ms dial context for an authenticated health round trip before registering their prompt. A slow response silently returned the hook to the terminal without Driga ever seeing the request. Prepare hook clients without that preflight and make registration the first authenticated request. Keep socket validation, token checks, bounded request lifetimes and fail-open behavior. General clients still check broker health before use. Add a deterministic cross-platform socket test that blocks health and delays registration beyond the old preflight budget, then verifies prompt visibility and an allow decision. The test fails with the original dial. Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The Claude permission hook no longer drops a prompt when the Driga broker answers slowly. It now connects with
chat.DialHook, which keeps the socket ownership checks and the client token but skips the separate/healthround trip, and sends its authenticated request first. Other clients still use the health check.Why
promptBrokergavechat.Dial200 ms, and that included an authenticated/healthround trip. On a loaded machine, or a slow Windows CI runner, the deadline expired before the hook ever registered. The hook then exited quietly and fell back to the terminal, so Driga never saw a real permission prompt. This madeTestPermissionHookBuiltBinaryfail on Windows in 2 of 3 runs after #80, including thev2026.10.23-alpharelease check. The reporting Mac runs at load 50 to 100, where the same drop can happen to real prompts. Raising the timeout was rejected: the time went to a preflight that adds nothing a registered request does not already prove.Risk and rollout
None beyond the hook's connect path. Fail-open is unchanged: with no broker, the hook still leaves the prompt to the terminal.
Contract changes
None
Verified
TestHookRegistersWithSlowBrokerserves the real broker handler on a private Unix socket on every platform, blocks/health, and delays/hook-promptby 300 ms. It failed before the fix withhook did not register prompt: ... /health: context deadline exceeded, and now passes.go test ./internal/chat(345 tests), also withTZ=UTC. AllTestPermissionHookBuiltBinarysubtests pass on macOS; the only failure is the pre-existing TempDir cleanup permission error on this Mac.go vetfor native, Linux and Windows.https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4