Summary
Running btw spawn codex 5.5 with an invalid or expired bearer token returns a 401 (expected), but also appears to destabilize the active OpenClaw gateway session, leading to a disconnect (gateway disconnected: closed | idle). This requires a manual openclaw gateway restart to recover.
Expected Behavior
btw command fails gracefully with authentication error
- Active agent session and gateway remain stable
- No disconnect or need for restart
Actual Behavior
Environment
- OpenClaw version: 2026.4.9
- OS: Linux Mint (Ubuntu/Debian-based)
- Hardware: ThinkPad X1 Carbon
- Active agent:
github-copilot/claude-opus-4.7
- Running via terminal (local install, systemd service)
Steps to Reproduce
-
Start OpenClaw normally (openclaw or agent session active)
-
Ensure bearer token for btw/Codex route is invalid or expired
-
Run:
-
Observe:
- 401 error
- gateway disconnect
Logs
btw failed: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"}}
gateway disconnected: closed | idle
Impact
- Breaks active session unexpectedly
- Requires manual gateway restart
- Makes
btw unsafe to test/debug in live sessions
- Poor failure isolation between auxiliary agent spawning and core gateway
Hypothesis
btw spawn may be:
- Sharing or mutating the same gateway client/session
- Not isolating failed auth paths
- Triggering a teardown on error instead of failing locally
Suggested Fix
- Isolate
btw spawn calls from main gateway session
- Ensure auth failures do not propagate to gateway lifecycle
- Add retry-safe or sandboxed execution for helper agents
Additional Notes
This feels like a boundary violation between auxiliary agent execution (btw) and core session stability. Even with invalid credentials, the main agent should remain unaffected.
Summary
Running
btw spawn codex 5.5with an invalid or expired bearer token returns a 401 (expected), but also appears to destabilize the active OpenClaw gateway session, leading to a disconnect (gateway disconnected: closed | idle). This requires a manualopenclaw gateway restartto recover.Expected Behavior
btwcommand fails gracefully with authentication errorActual Behavior
btwreturns:Immediately followed by:
Session becomes unusable until:
Environment
github-copilot/claude-opus-4.7Steps to Reproduce
Start OpenClaw normally (
openclawor agent session active)Ensure bearer token for
btw/Codex route is invalid or expiredRun:
Observe:
Logs
Impact
btwunsafe to test/debug in live sessionsHypothesis
btw spawnmay be:Suggested Fix
btwspawn calls from main gateway sessionAdditional Notes
This feels like a boundary violation between auxiliary agent execution (
btw) and core session stability. Even with invalid credentials, the main agent should remain unaffected.