feat(work-runs): hand off remote conversation turns - #946
Closed
Neonforge98 wants to merge 2 commits into
Closed
Conversation
Collaborator
Author
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.
Problem
A Work Item discussion Run can target a cloud-shared root Session that is owned by another member and therefore does not exist in the comment sender’s local Session store. The durable dispatcher currently treats that root like a normal local resume target, so delivery fails instead of handing execution to the sender’s own local continuation. A simple frontend event is not sufficient: acceptance, runner preparation, transport acceptance, and outbox acknowledgement must share one fenced identity or a crash can duplicate or lose the turn.
Solution
Add a backend-only remote-root hand-off protocol on top of the existing WorkItemRun outbox. The dispatcher preserves the immutable shared root, emits a claim-token-fenced offer, keeps the lease alive while a capable frontend window queues/setup/sends, durably prepares the exact local runner before send, and marks delivery only after the exact Run intent is accepted. Reclaims reuse a prepared runner hint, stale windows cannot prepare or acknowledge, terminal-before-ack retires the outbox atomically, and retries never promote the hidden runner into the shared root target. Existing local native and CLI resume paths continue through the same dispatcher acknowledgement helper. Typed Tauri RPCs expose accept/release/nack/prepare/ack for the next stacked frontend bridge. Team Chat is untouched.
Potential risks
claim_tokencolumn onpm_dispatch_outbox; schema initialization upgrades existing databases idempotently.Validation
cargo test -p project_management --no-fail-fast(626 passed)cargo test -p agent_core conversation_turn_bridge --no-fail-fast(9 passed)cargo test -p agent_core work_item_run_dispatcher --no-fail-fast(3 passed)cargo check -p org2pnpm exec tsc --noEmit --pretty falseagent_core,project_management), ESLint/circular statsStack
Base: #945 (
codex/cloud-conversation-runtime-adapter). The next PR installs the thin Work Item frontend listener using the shared cloud runtime adapter and persistent continuation runner.