Skip to content

🤖 refactor: share the task launch blocks between the reserved launch and task creation - #7752

Merged
ThomasK33 merged 2 commits into
refactor/task-launch-tests-2from
refactor/task-launch-helpers
Oct 30, 2026
Merged

ThomasK33 merged 2 commits into
refactor/task-launch-tests-2from
refactor/task-launch-helpers

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

The reserved task launch (startReservedAgentTaskLeased) and the task creation steps under createUnderTaskTreeLifecycleLock repeat five blocks. This PR moves each into one shared function that both call, with no behaviour change. It is the shared-helper PR of stack 10, as decided in the "TaskService recovery and launch path plan" (one helper PR before the split). startReservedAgentTaskLeased goes from CC 65 to 60. Changed lines: 291.

The shared functions

Function Block Reserved launch Task creation
registerTaskBackgroundInit the AbortController and registerExternalBackgroundInit(runBackgroundInit(...)) after its four pre-init rechecks announceAndInitTask
taskForkOptions the orchestrateFork options; callers pass the source runtime and the preferred trunk branch materializeReservedTaskWorkspace buildTaskForkOptions (keeps its trunk-branch rule)
readTaskBaseCommits the base-commit read with its eight fields and the parent project's SHA the checkout persist materializeTaskCheckout
launchAdmissionRefusalMessage the admission refusal message the send admission sendTaskLaunchPrompt
launchSendErrorMessage the send error message the send failure sendTaskLaunchPrompt

Not shared, on purpose

  • The secrets read: one expression in each caller. The reserved launch's rechecks sit between it and the init registration.
  • Sanitize: marking the checkout unsanitized comes after an await, so a shared helper would be async and would move the caller's next call one microtask later.
  • The persisted row fields: a spread into the new row would change the key order that config.json is written in.

Validation

  • A script lists every call and await in the six touched methods in evaluation order, inlines the new functions, and compares base with head. All six match (144, 18, 22, 3, 12 and 17 entries). The script reported a difference for both bad edits it was tested with.
  • readTaskBaseCommits is the old reader, reshaped, not wrapped. A wrapper would add an await. Task creation now builds the base object once, before editConfig, instead of inside its callback. The callback only reads it.
  • The 12 tests from 🤖 tests: cover startReservedAgentTaskLeased paths before the split #7751 and the creation, admission and settlement suites pass. make dry-check finds no new duplicates.

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

…and task creation

startReservedAgentTaskLeased and the createUnderTaskTreeLifecycleLock steps
repeated five launch blocks. Each block is now one function that both paths
call, with the same calls in the same order and no new or removed await:

- registerTaskBackgroundInit: the abort controller and the registered
  runBackgroundInit (announceAndInitTask, and the reserved launch after its
  pre-init rechecks). Sync.
- taskForkOptions: the orchestrateFork options. The reserved launch
  (materializeReservedTaskWorkspace) and buildTaskForkOptions pass their own
  source runtime and create-fallback trunk branch. Sync.
- readTaskBaseCommits: the old readTaskBaseCommitShaByProjectPath, now taking
  the plan and the checkout and also returning the parent project's SHA, so
  neither caller repeats the eight fields or the lookup. Still one await at
  each call site.
- launchAdmissionRefusalMessage, launchSendErrorMessage: the refusal and send
  failure messages.

Not shared: the secrets read (one expression), the sanitize block (an awaited
helper would run the reclaim or failTaskLaunch a microtask later), and the six
row keys (a spread would reorder the keys of the row createUnder persists).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T10:47:31.388672Z 1a79ecd Manual request
🔒 Security Review ✅ Completed 2026-10-30T10:48:55.896530Z 1a79ecd 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 83a3c6a889

ℹ️ 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: 83a3c6a889

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

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 46.3k tokens (28% cached)
Spend: $0.09 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.5s
🟢 a chat survives a restart of the server 1 step · 1 call 5.5s
🟢 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.4s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.4s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 9.8s
🟢 a chat survives trips through Settings 2 steps · 1 call 9.8s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 3.9s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 3.9s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.7s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.7s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 7.1s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 7.1s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.1s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.1s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 28.9s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.8s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.5s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.6s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 6.6s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 6.6s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 2.8s

e2e 0.20.0 · 1m 18s · 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 5.3s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.3s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 6.6s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 6.6s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.1s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.1s

e2e 0.20.0 · 19.3s · 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 changed the base branch from refactor/task-launch-tests to refactor/task-launch-tests-2 October 30, 2026 10:45
@ThomasK33
ThomasK33 added this pull request to stack #7762 October 30, 2026 10:45
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 1a79ecd1a3

ℹ️ 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: 1a79ecd1a3

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.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 520e944 Oct 30, 2026
33 of 34 checks passed
@ThomasK33
ThomasK33 deleted the refactor/task-launch-helpers branch October 30, 2026 11:38
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