Skip to content

fix: recover the Grok bridge from a deleted task folder and a second connector - #9

Merged
TudorAndrei merged 2 commits into
mainfrom
t3/0349a133
Nov 11, 2026
Merged

TudorAndrei merged 2 commits into
mainfrom
t3/0349a133

Conversation

@TudorAndrei

@TudorAndrei TudorAndrei commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

After the box migration on Nov 10 deleted /home/box/.aether/tasks, the Grok Bot connector on 0.3.0 stopped working, and it failed in two ways. First, the node refused to start with node policy is invalid at workspace. Second, after the folder was made again by hand, the app's second connector process exited with Node runtime is locked, so every tool call failed.

What changes

stateDiagram-v2
    [*] --> Acquire: connector process starts
    Acquire --> Owner: lock is free / lock owner pid is dead (take over)
    Acquire --> Proxy: lock owner answers on bridge.sock
    Acquire --> Retry: owner still starting
    Retry --> Acquire: after 250 ms
    Retry --> Failed: 10 s and no answer (error names the pid)
    Owner --> Owner: proxies connect and disconnect
    Owner --> [*]: own client closed and no proxies, or node exited (error ends with node's last stderr line)
    Proxy --> Acquire: owner went away
    Proxy --> [*]: own client closed
Loading

Before: the only path was "lock is free → own the node", and every other path ended in Node runtime is locked.

  • Node (node_builder.rs): if the policy workspace is missing and it is the default <data-dir>/../tasks folder, startup makes the folder again. A missing custom workspace still fails startup, but the error now reads node policy workspace <path> cannot be opened (entity not found); ….
  • Bridge: runtime.lock/owner.json records the bridge and node pids. When a stale lock's orphaned node is still running, the new bridge stops it only after /proc/<pid>/cmdline confirms that the process is serve for this data directory. Otherwise the error names the pid. An empty lock left by a 0.3.0 bridge is still reported rather than removed, because its owner cannot be identified.
  • Bridge: Local Aether node exited (code N): <last stderr line>.

Look at: integrations/grokbot-bridge/src/runtime.mjs: the lock takeover (rename, then re-check the owner) and the owner/proxy protocol.

Evidence

  • mise run fmt: passes.
  • mise run lint (clippy 1.98): passes.
  • cargo test -p aether --lib node_builder: 20 passed, including 2 new tests: a deleted default task folder is made again, and a missing owner workspace fails startup with an error that names its path.
  • npm test in integrations/grokbot-bridge: 15 passed. The 7 new tests in test/runtime.test.mjs cover forwarding and taking over, stale-lock takeover, stopping an orphaned node, never signalling an unrelated pid, unrecorded and unanswering locks, the exit message with the node's stderr line, and two real stdio connectors sharing one fake node, where the second restarts the node after the first closes. The runtime tests passed 3 times in a row.
  • Full cargo test --workspace: agent::codex::tests::{app_server_time_limit_covers_the_full_turn, dropping_a_session_stops_the_commands_the_app_server_started} and 3–4 timing-sensitive feature scenarios (outbox.feature:15, replay-and-overload.feature:20, task-lifecycle.feature:12/29) fail. They fail on a clean main worktree on this machine too, where the fake agent finishes before the "running" check. They are unrelated to this change.
  • Not checked: a live Grok connector.

Merge danger

Door: two-way
Blast radius: one node

The node change only affects startup when the workspace is missing. The bridge is experimental and runs from a source checkout. A 0.3.0 bridge that is still running holds an empty lock that the new code will not take over, so the box must restart the connector after updating.

After merge

  1. Release a new version (the release workflow, workflow_dispatch).
  2. On the box: update the checkout or binary, stop the running bridge and its node, then restart the connector once.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

TudorAndrei and others added 2 commits November 11, 2026 23:38
A node whose default task folder (`<data-dir>/../tasks`) was deleted, for
example by a machine migration, refused to start with "node policy is
invalid at workspace". That folder belongs to the node, so startup now
makes it again. A missing custom workspace still fails startup, and the
error now names the path and the reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A client can start the stdio connector more than once, for example to
list tools on a second connection. The second bridge found the runtime
lock held and exited with "Node runtime is locked", so tool calls failed.

The first bridge now owns the node and serves the executor tools on
`grokbot-bridge/bridge.sock`. Later bridges forward their calls to it. The
owner keeps the node while any connector uses it, and a remaining
connector takes over when the owner exits. The lock records the owner
and node process IDs, so a lock left by a crashed bridge is taken over;
on Linux its orphaned node is stopped first.

"Local Aether node exited" now ends with the node's last stderr line and
its exit status, so the real cause reaches the client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TudorAndrei
TudorAndrei merged commit 2be7f31 into main Nov 11, 2026
8 checks passed
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