Skip to content

🤖 refactor: move parked peer sends into PeerSendParking - #7667

Merged
ThomasK33 merged 1 commit into
refactor/task-workflow-run-attentionfrom
refactor/task-peer-send-parking
Oct 27, 2026
Merged

ThomasK33 merged 1 commit into
refactor/task-workflow-run-attentionfrom
refactor/task-peer-send-parking

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves peer sends that wait for a delegated turn (parkedPeerSendsByTarget, parkedPeerSendFlushLocks) and the turn registration epochs (workspaceTurnRegistrationEpochs) into a new PeerSendParking class (peerSendParking.ts). taskService.ts loses 99 lines in this layer.

Background

PR 2 to 5 of the TaskService split stack (#7665 is PR 1). Each layer moves one group of TaskService state and the methods that own it into a plain class that TaskService builds in its constructor. The rules are the same in every layer: public methods stay on TaskService as one-line facades, methods that tests spy on or patch stay reachable on TaskService and the new class calls them through call-time closures, and tests that cast a moved field change only the cast target. No behaviour changes.

Implementation

  • Moved unchanged: parkPeerSend, scheduleParkedPeerSendFlush, flushParkedPeerSends, onWorkspaceTurnRegistered and the ParkedPeerSend type.
  • flushParkedPeerSends stays on TaskService as a private facade, because six test sites spy on it, mock it or bind it. The class's scheduled flush calls it back through deps.flush, so the spies see every flush. sendTreeMessage (also spied) is a closure too.
  • onWorkspaceTurnRegistered stays public on TaskService (TaskHost needs it).
  • Accessors for code that stays: countParked (the peer-message broker's queue cap), hasParked and removeRetry (sendTreeMessage), registrationEpoch (the 🤖 Delegated-turn peer delivery: drain drops the rest on a replacement turn; fix stale task_send_message sentence #5271 retry gate), dropParked (markParentWorkspaceInterrupted).
  • TreeMessageSpec and PeerDelegatedTurnWait are now exported types from taskService.ts. The new file imports them as import type.
  • Tests: taskService.peerLimitsRepro.test.ts changes its cast target. The new peerSendParking.test.ts (11 tests) covers park order, holds while a registration or stop is live, the stop baseline, dropped retries, dropParked during a drain, and a send parked during a drain.

Validation

  • Tests on this layer and the stack top: all pass.
  • make static-check, make lint-eslint: pass. make crap-check: flushParkedPeerSends is CC 11. The new test covers all 78 lines of the file, so its CI CRAP score is 11 (limit 15).
  • make dry-check: onWorkspaceTurnRegistered matches two existing per-key counters. A dry-duplicate-ok: marker says why they stay apart.
  • Mutation on the new class: 4 equivalent ?? → || survivors, marked.

Risks

Low. Park first, then schedule, and one flush at a time per target, as before.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $53.33

PeerSendParking owns the peer messages parked behind a root's delegated
workspace turn (#4997), their per-target flush locks and the delegated-turn
registration epochs (#5271). Move-only: the bodies of parkPeerSend,
scheduleParkedPeerSendFlush, flushParkedPeerSends and onWorkspaceTurnRegistered
are unchanged.

TaskService keeps onWorkspaceTurnRegistered (TaskHost) and a private
flushParkedPeerSends facade, because tests spy on it; the scheduled flush and
the drain's sendTreeMessage call back through TaskService closures so spies see
every call. sendTreeMessage, the broker's queue-cap count and the user-Stop drop
use small accessors.
@ThomasK33
ThomasK33 added this pull request to stack #7670 October 27, 2026 07:59
@ThomasK33 ThomasK33 changed the title 🤖 refactor: move peer-send parking into PeerSendParking 🤖 refactor: move parked peer sends into PeerSendParking Oct 27, 2026
@ThomasK33
ThomasK33 marked this pull request as ready for review October 27, 2026 08:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T08:03:22.913979Z be16e97 Manual request
🔒 Security Review ✅ Completed 2026-10-27T08:03:49.295246Z be16e97 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: be16e97fcd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: be16e97fcd

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 46.2k tokens (28% cached)
Spend: $0.08 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 5.0s
🟢 a chat survives a restart of the server 1 step · 1 call 5.0s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.2s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.2s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.7s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.7s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 8.8s
🟢 a chat survives trips through Settings 2 steps · 1 call 8.8s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.0s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.0s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.5s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.5s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.4s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.4s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.8s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.8s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 21.2s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 4.3s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 3.4s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.3s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.4s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.1s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 2.7s

e2e 0.20.0 · 1m 9s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.0k tokens (32% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 8.5s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 8.5s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 7.2s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 7.2s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.2s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.2s

e2e 0.20.0 · 23.2s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 480f34b Oct 27, 2026
48 of 66 checks passed
@ThomasK33
ThomasK33 deleted the refactor/task-peer-send-parking branch October 27, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant