Skip to content

🤖 refactor: the agent definitions service builds host-local runtimes through the RuntimeFactory - #7420

Merged
ThomasK33 merged 2 commits into
mainfrom
phase5/b-agent-definitions-service
Oct 24, 2026
Merged

ThomasK33 merged 2 commits into
mainfrom
phase5/b-agent-definitions-service

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

5b PR 8c of phase 5 (Loop host I/O) of the agent-loop refactor. The agent definitions service builds its host-local runtimes through the session's RuntimeFactory (claim 3.3) instead of new LocalRuntime. This completes 5b PR 8. Behavior does not change: on the host, every caller gets the Node layer (nodeRuntimeFactory), whose createLocalRuntime is new LocalRuntime.

Order

Base main. 5b PR 8a (#7415, Runtime.location) and 5b PR 8b (#7417, the agent skills service) merged. When #7417 merged, the native stack rebased this PR onto main 6887934 as head 73d36a5. This PR replaces the temporary nodeRuntimeFactory that 8b passes to resolveGlobalRuntime in agentDefinitionsService.ts.

Implementation

  • agentDefinitionsService.ts: discoverAgentDefinitions, readAgentDefinition, resolveAgentBody, resolveAgentDefinition and resolveAgentFrontmatter take a required runtimeFactory (ReadAgentDefinitionOptions). The plugin container scans and the global scan build their host runtime through it. resolveHeadlessAgentDefinition takes the factory as an argument.
  • resolveAgentInheritanceChain.ts and resolveNodeAgentAiSettings.ts (NodeAgentDefinitionContext) carry a required runtimeFactory to the base-definition reads.
  • Callers in the loop (agentResolution.ts, turnContextAssembler.ts, turnRequestBuilder.ts, continuousCompactionSummary.ts) pass the session's factory.
  • Callers outside the loop (taskService.ts, workspaceService.ts, workspaceTurnManager.ts, gitPatchArtifactService.ts, memoryConsolidationService.ts, agentPlugins/composition.ts) pass nodeRuntimeFactory explicitly, with a comment.

The tests change in 8 files: the new case below, and runtimeFactory in the calls that typecheck listed.

As in 8b, plugin discovery and its containment checks still read the process filesystem next to the factory's runtime. Item 12 of the phase 5 follow-ups on #7255 tracks it, with the 5b proof PR as its trigger.

resolveAgentDiscoveryContext (the ORPC entry point) still builds its runtime with the free createRuntimeForWorkspace and createRuntime. Item 11 of the phase 5 follow-ups on #7255 tracks it, with the 5b proof PR as its trigger.

Validation

  • agentDefinitionsService.test.ts: a new case "resolves plugin containers through the host-local runtime of the RuntimeFactory it was given". The factory's host runtime resolves ~/ to a temp home that holds a plugin agent. With the scans on new LocalRuntime, the case fails: discovery reads the real home. With this PR, it passes.
  • After this PR, rg -n 'new LocalRuntime|instanceof (LocalBaseRuntime|DevcontainerRuntime|RemoteRuntime)' prints nothing for the 5 files of 5b PR 8 (the plan's done check).
  • The changed callers' tests with agentDefinitions/, agentSkills/, workflows/ and the task, turn-manager, git-patch and continuous-compaction tests: 2922 pass, 0 fail.
  • make static-check, make lint-eslint, make crap-check and make dry-check (dry-check with the marker of 8b).
  • make test (host suite lock) on head bd0dae3: bun test src had 27881 pass, 7 skip, 0 fail. The shared scripts/storybook/vscode run had 729 pass, 1 skip, 0 fail, and the 18 isolated files had 0 fail. Loop-test tripwire, 3 runs against 8b's head 63b6943: 0 trips.
  • Head bc53832 merges 8b's head 63b6943, which brings main bc1fecf (🤖 fix: install plugins whose root plugin.json has no $schema #7406, which touches no file of this PR).
  • On head 73d36a5 (after the restack onto main 6887934, which brings 🤖 refactor: removal, refine and the durable journal take their locks from SessionLocks #7404 and 🤖 feat: collapsible Pinned, Recent and Projects sections in the flat sidebar #7418): typecheck passes, and make test (host suite lock) passed: bun test src had 27898 pass, 7 skip, 0 fail, the shared run had 729 pass, 1 skip, 0 fail, and the 18 isolated files had 0 fail. Loop-test tripwire, 3 runs against main: 0 trips. The diff against main equals the pre-restack diff against 8b, apart from line offsets in workspaceService.ts.

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

@ThomasK33
ThomasK33 added this pull request to stack #7421 October 24, 2026 14:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T14:39:33.312869Z 73d36a5 New commits
🔒 Security Review ✅ Completed 2026-10-24T14:39:44.434885Z 73d36a5 New commits
ℹ️ 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.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

27 agent steps · 7 replayed from cache · 31 model calls · 218.8k tokens (74% 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 2 steps · 4 calls 23.7s
🟢 a chat survives a restart of the server 2 steps · 4 calls 23.7s
🟢 compaction.e2e.ts · 1 passed 3 steps · 7 calls 44.7s
🟢 /compact replaces the old chat with a summary 3 steps · 7 calls 44.7s
🟢 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 3 steps · 5 calls 30.4s
🟢 a chat survives trips through Settings 3 steps · 5 calls 30.4s
🟢 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 3.1s
🟢 the agent opens the playground workspace 2 steps · 1 call 3.1s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.7s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.7s
🟢 todoNudge.e2e.ts · 1 passed 2 steps · 4 calls 27.4s
🟢 the agent finishes open TODO items after the turn-end nudge 2 steps · 4 calls 27.4s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 25.7s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 7.2s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.0s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.4s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.1s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 2.9s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 4.1s

e2e 0.20.0 · 2m 58s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.1k 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 6.0s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 6.0s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.4s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.4s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 6.0s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 6.0s

e2e 0.20.0 · 19.4s · 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

Base automatically changed from phase5/b-skills-service to main October 24, 2026 14:37
@ThomasK33
ThomasK33 force-pushed the phase5/b-agent-definitions-service branch from bc53832 to 73d36a5 Compare October 24, 2026 14:37
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit d1f9d61 Oct 24, 2026
33 of 34 checks passed
@ThomasK33
ThomasK33 deleted the phase5/b-agent-definitions-service branch October 24, 2026 15: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