[codex] Reduce iMessage turn setup latency#96199
Conversation
|
Live PR-branch test update from
Conclusion: PR #96199 improves and instruments the path, but live testing shows it does not fully eliminate plugin runtime rebuilds. Next patch should target the compaction/session/provider registry loader paths, not only plugin-tool resolution. |
|
Follow-up pushed to PR #96199: What changed:
Proof:
This targets the provider-hook side of the post-startup re-registration seen in the live PR-branch run. A fresh live test from a non-local iMessage sender is still needed for wall-clock proof. |
|
Clean steady-state PR-branch iMessage sample from 2026-06-23 16:59 PT:
Conclusion: the PR removed the repeated plugin/runtime setup from the steady-state hot path. The clean remaining wall clock is dominated by the provider/model turn: ~1.55s from turn accepted to first event, then ~8.65s until the |
|
Codex review: found issues before merge. Reviewed June 23, 2026, 10:30 PM ET / 02:30 UTC. Summary PR surface: Source +814, Tests +1095, Docs 0, Other 0. Total +1909 across 37 files. Reproducibility: yes. with caveat: the linked issue and PR comments provide live iMessage timing samples and the source paths are clear, but this read-only review did not run a fresh live iMessage reproduction. Review metrics: 3 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land or review the narrow cache-key-compatible startup registry reuse path in #96231, keep #96148 as the tracker, and defer provider-hook/plugin-tool cross-workspace reuse until it has explicit compatibility proof or maintainer approval. Do we have a high-confidence way to reproduce the issue? Yes, with caveat: the linked issue and PR comments provide live iMessage timing samples and the source paths are clear, but this read-only review did not run a fresh live iMessage reproduction. Is this the best way to solve the issue? No: the broad branch is a useful investigation artifact, but the best merge path is a narrower compatible registry-reuse PR plus separate proof for provider/tool reuse. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d42b86421969. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +814, Tests +1095, Docs 0, Other 0. Total +1909 across 37 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@/var/folders/ks/54l0_v5j441gbf_8nbz9kgb80000gn/T/tmp.Q0LIOYEchk |
What Problem This Solves
Tracks the iMessage source-reply latency investigation from #96148 and packages the first two concrete improvements from the tracing work:
The live traces showed gateway startup/prewarm could reuse the runtime registry, but per-turn tool construction still re-registered expensive external plugins such as
travel-hubandporsche-connect-cliwhen the turn workspace differed from the gateway workspace.Why This Change Was Made
The plugin tool resolver matched registry reuse against the turn workspace. In gateway mode, plugin metadata and runtime registries are process-stable, so the active gateway registry workspace is the canonical workspace for deciding whether the already-loaded registry can satisfy a scoped tool request. This PR makes plugin tool lookup use that active workspace only for existing-registry reuse; fresh standalone loads still use the request context.
This also adds the tracing and iMessage reliability fixes used to gather the data:
subscribe()returnsUser Impact
Users should see less avoidable setup work before an iMessage reply turn starts, especially with enabled external tool plugins. Verbose traces should also be easier to read because the secondary bundled-tool policy audit no longer appears as another primary hot-path policy pass.
This does not claim to fix the separate startup warmup stall observed in the latest live run: model warmup still stalled for roughly 116s before post-ready plugin prewarm in the narrowed config. That remains tracked in #96148.
Evidence
node scripts/run-vitest.mjs extensions/imessage/src/status.test.ts extensions/imessage/src/monitor.last-route.test.ts extensions/imessage/src/monitor.watch-subscribe-retry.test.tsnode scripts/run-vitest.mjs src/agents/runtime-plugins.test.ts src/agents/runtime-plugins.registry-reuse.test.ts src/plugins/loader.runtime-registry.test.tsnode scripts/run-vitest.mjs src/plugins/tools.optional.test.tsnode scripts/run-vitest.mjs src/plugins/tools.optional.test.ts src/agents/embedded-agent-runner/effective-tool-policy.test.ts src/agents/agent-bundle-mcp-tools.request-boundary.test.tsnode scripts/run-vitest.mjs src/agents/runtime-plugins.test.ts src/agents/runtime-plugins.registry-reuse.test.ts src/plugins/loader.runtime-registry.test.ts extensions/imessage/src/status.test.ts extensions/imessage/src/monitor.last-route.test.ts extensions/imessage/src/monitor.watch-subscribe-retry.test.tspnpm tsgo:prodgit diff --check.agents/skills/autoreview/scripts/autoreview --mode local --prompt "Review the current OpenClaw performance/tracing patch. Focus on plugin runtime registry reuse, bundled tool-policy audit level, iMessage monitor/client changes, and auth profile snapshot reuse. Treat the full dirty tree as intended PR scope."Live diagnostic evidence:
travel-hubandporsche-connect-cliduring the message turn and the embedded run completed in 8445ms.Tracking issue: #96148