Repository navigation
Phase 3, ticket #22: Hand-off delivery works with real postgres-mode thread access - #26
Merged
Merged
Conversation
…22) copilot.ts's postgres branch returned throwing stand-ins for threadLock/history/runnerConnection (Phase 1), since nothing called them while hand-offs were guarded off entirely. Replaced with real implementations backed by the Phase 2 ThreadBackend: - CopilotRuntimeMount.runner replaces runnerConnection: it hands out the actual runner instance mountCopilotRuntime drives chat through, not connection details to build a second one. In postgres mode this is the literal same PostgresAgentRunner the mounted CopilotRuntime uses -- one shared instance, not a second one, which is what makes decision #28's idempotent re-acquire fix load-bearing here too. - threadLock is createPostgresThreadLock (new, beside createPostgresThreadBackend): creates the thread if needed, then locks it, firing onRunBusy -- the postgres-mode mirror of createIntelligenceThreadLock, simpler since ThreadBackend.acquire already answers a conflict with null and there is no Learning container to resolve in this mode. - history reads through ThreadBackend.getThreadMessages. handoff-wiring.ts now takes copilotRuntime.runner directly instead of building its own IntelligenceAgentRunner from connection details. index.ts's mode guard on startHandoffDelivery is removed. New tests (handoff-postgres-backend.test.ts) drive createHandoffDelivery against this real postgres-mode trio directly: a hop into its own scratch thread, locked and released; and a scratch thread somebody else already holds, waited for rather than failed. Existing hand-off and group-conversation tests continue to pass unchanged, confirming intelligence mode is untouched. See docs/brooklyn/DECISIONS.md #29. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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.
Summary
copilot.ts's postgres branch returned throwing stand-ins forthreadLock/history/runnerConnection(Phase 1), since nothing called them while hand-offs were guarded off entirely. Replaced with real implementations backed by the Phase 2ThreadBackend.CopilotRuntimeMount.runnerreplacesrunnerConnection: it hands out the actual runner instancemountCopilotRuntimedrives chat through, not connection details to build a second one. In postgres mode this is the literal samePostgresAgentRunnerthe mountedCopilotRuntimeuses — one shared instance, not a second one, which is what makes decision Approval resumption's saved-tool-call check reads through ThreadBackend #28's idempotent re-acquire fix load-bearing here too.createPostgresThreadLock(besidecreatePostgresThreadBackend): creates the thread if needed, then locks it, firingonRunBusy— the postgres-mode mirror ofcreateIntelligenceThreadLock, simpler sinceThreadBackend.acquirealready answers a conflict withnulland there's no Learning container to resolve in this mode.handoff-wiring.tsnow takescopilotRuntime.runnerdirectly instead of building its ownIntelligenceAgentRunnerfrom connection details.index.ts's mode guard onstartHandoffDeliveryis removed.See
docs/brooklyn/DECISIONS.md#29 for the full reasoning, including why the "3-Bot group" acceptance criterion is covered structurally (ticket #21'screateTurnRunnerfix + this ticket's real thread access) rather than by a new dedicated test, with a genuine browser-level run-through left to Aswin's Phase 4 manual checklist.Closes #22.
Test plan
bun run typecheck/bun run lint— greenhandoff-postgres-backend.test.ts: drivescreateHandoffDeliveryagainst the real postgres-moderunner/threadLock/historytrio directly — a hop into its own scratch thread (locked, runs, released), and a scratch thread somebody else already holds (waited for, not failed)agent-handoff-delivery.test.ts,learning-handoff.test.ts,group-conversations*.test.ts,enterprise-controls.integration.test.ts— all pass unchanged, confirming intelligence mode's hand-off behavior is untouchedbun test): 8206 pass / 18 fail / 9 errors, same pre-existing categories (agent-bot subprocess$PATH, live-provider network tests, one load-induced timeout flake) — no regressions🤖 Generated with Claude Code