Repository navigation
🤖 refactor: split sendTreeMessage, part 5: request, route and endpoint gates - #7713
Conversation
…t gates Moves the start of the peer send out of sendTreeMessage: the lock callback becomes admitPeerSendUnderLock, which runs resolvePeerSendRoute (retry removal, endpoint read, relation, consent and tag re-checks), refusePeerSendByEndpoint, refusePeerSendByIsolation and refusePeerSendByArchive, then the steps from parts 1 to 4. The assertion name moves to treeMessageAssertionName, and the fixed refusals come from createPeerSendRefusals, one set per send. No behaviour change. sendTreeMessage keeps its overloads and signature. It reads the request before the lock, as before, and its lock callback returns the step chain's promise, so both admission locks release when the send settles. sendTreeMessage drops from CC 28 to CC 6. Every new step is CC 8 or less.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
🟢 e2e stories (Haiku): 14 passed22 agent steps · 7 replayed from cache · 15 model calls · 46.2k tokens (28% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 15s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 8.0k tokens (32% cached) All 3 tests in 3 files
e2e 0.20.0 · 18.4s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
Part 5 of 5: splits the start of
TaskService.sendTreeMessage(request, route and endpoint gates) in place, with no behaviour change. The method drops from CC 28 to CC 6. On top of part 4. 350 changed lines.Across the five parts,
sendTreeMessagegoes from CC 133 to CC 6, and all 38 new functions score CC 8 or less.Steps in this part
admitPeerSendUnderLockreplaces the old async lock callback, so a synchronous throw still becomes a rejection.resolvePeerSendRoutekeeps the relation check under the lock after the config read.refusePeerSendByEndpoint,refusePeerSendByIsolationandrefusePeerSendByArchiveare the endpoint gates.treeMessageAssertionNameandcreatePeerSendRefusalsare module functions. The send creates one set of refusals each time, because the code compares refusals by identity.targetIsAgentTaskand the refusal set are now computed inresolvePeerSendRoute, before the runtime, sender, workflow, best-of and archive gates. Both read only the same config snapshot.Rules every part keeps
sendTreeMessagedo not change. No step callsthis.sendTreeMessageagain, so the spy intaskService.delegatedTurnPeerDelivery.test.tsstill sees every call.withPeerAdmissionLock(targetId, ...), which is the peer delivery lock plus the target's event lock. No step takes either lock, and the callback returns the chain, so both locks release when the chain settles.sendMessageand the workspace service run later (admissionStale, park,onCanceled,onAccepted) read and write one mutablePeerSendAttemptrecord when they run:delegatedTurnCorrelation,admissionRefusal,refusedAtRegistrationEpoch,parkedThisAttemptandaccepted.admissionStalestays a plain synchronous function.make crap-checkagainst the parent commit reports 0 violations, with and without coverage. Every new function scores CC 8 or less.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$198.09