fix(subagents): keep thread-bound spawns isolated by default#78060
fix(subagents): keep thread-bound spawns isolated by default#78060100yenadmin wants to merge 0 commit into
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-reproducible: omitted Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the central fallback, docs, and test update once exact-head checks are green, while leaving stale announce freshness to #78055 or a focused follow-up. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: omitted Is this the best way to solve the issue? Yes: changing Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against eb3de9502514. Re-review progress:
|
e354868 to
f2458d8
Compare
|
Replacement PR opened at #79050 from a fresh OpenClaw-owned branch. This closed PR's current head ( |
Refs #78055.
Summary
sessions_spawncontext fromforktoisolated.context: "fork"and explicitthreadBindings.defaultSpawnContext: "fork"behavior.Why
The issue evidence showed subagent sessions unexpectedly carrying unrelated requester transcript history (
forkedFromParent: true). Thread-bound subagent spawns were the remaining path where OpenClaw silently forked requester history even though the tool prompt says children start isolated unlesscontext: "fork"is requested. That implicit fork can make a new worker answer old requester context and then auto-announce the wrong result.Real behavior proof
contexton thread-bound nativesessions_spawncurrently resolves tofork, so child sessions inherit requester transcript history unless users explicitly configurethreadBindings.defaultSpawnContext. This PR changes the implicit default toisolated.~/Projects/clawdbot, running OpenClaw2026.5.6at commit1692264, with the live gateway healthy and Discord/Telegram configured. The after-fix comparison used this PR checkout at.worktrees/pr-78060with the same livesession.threadBindingsconfig read from~/Projects/clawdbot.node scripts/run-node.mjs config get session.threadBindings --jsonin~/Projects/clawdbot, then ran anode --import tsxscript in.worktrees/pr-78060importingresolveThreadBindingSpawnPolicyand applying the live config to Discord and Telegram thread-bound subagent spawn policy.{ "codeCwd": "/Users/phaedrus/Projects/openclaw/.worktrees/pr-78060", "liveConfigSource": "/Users/phaedrus/Projects/clawdbot", "liveConfigThreadBindings": { "enabled": true, "idleHours": 24, "maxAgeHours": 0 }, "effectivePolicies": { "discord": { "channel": "discord", "accountId": "default", "enabled": true, "spawnEnabled": true, "defaultSpawnContext": "isolated" }, "telegram": { "channel": "telegram", "accountId": "default", "enabled": true, "spawnEnabled": true, "defaultSpawnContext": "isolated" } } }Before-fix live output from the same live config under
~/Projects/clawdbotreturneddefaultSpawnContext: "fork"for both Discord and Telegram.{"enabled":true,"idleHours":24,"maxAgeHours":0}and nodefaultSpawnContextoverride), this PR resolves both Discord and Telegram thread-bound subagent spawn policy todefaultSpawnContext: "isolated". That is the behavior users get when they omitcontexton thread-bound nativesessions_spawnafter this patch.Testing
node scripts/test-projects.mjs src/channels/thread-bindings-policy.test.ts src/agents/subagent-spawn.context.test.tspnpm tsgo:test:srcpnpm config:docs:checkpnpm config:channels:checkpnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/.generated/config-baseline.sha256 src/config/types.base.ts src/config/types.discord.ts src/config/bundled-channel-config-metadata.generated.ts src/channels/thread-bindings-policy.ts src/channels/thread-bindings-policy.test.ts src/agents/subagent-spawn.context.test.ts extensions/discord/src/config-ui-hints.ts extensions/telegram/src/config-ui-hints.tsorigin/main:pnpm build,pnpm check,pnpm testNotes
This is the isolated-session root cause/fix. It does not try to redesign completion announce delivery policy; stale announce freshness after explicit forks may still need a follow-up if reviewers want stricter delivery validation.