OpenClaw: Green Tests, Wrong Computer

Outline

Transcript

0:00 Imagine Mara moves a validation call ahead of a ledger write, then asks OpenClaw to test the patch. The agent runs `pytest tests/integration`. Tests pass, while her laptop's changed code remains untested. She has the wrong evidence for a release. We see green and we're ready to move on. But where did this command run? Let's follow our invented interaction through OpenClaw's code. We'll find the checkout that earned that green, then trace Mara's correction into a process. Sources are in the description, pinned September 30th.

0:32 First, the call specifies neither host nor starting directory. Its result records exit code zero and `/srv/ledger`, but the foreground result builder has no universal host field. A directory name alone doesn't identify the computer. In our configuration, auto chooses Gateway because there's no available or required sandbox. Gateway is the computer running OpenClaw's coordinator. Her phone delivered the message; the server starts the shell process. For example, the tool falls back to its default folder, our older server checkout. Yesterday's code passes yesterday's tests.

1:05 That's an impressively healthy wrong checkout. Mara now selects laptop-seven and points the command at her patched ledger folder. She keeps the same integration suite. Before that correction becomes a tool call, a configured peer-specific routing rule selects her work agent. OpenClaw then chooses which conversation to load for that agent. Suppose a colleague could message that agent too, and had said, “Skip integration; run the quick tests.” That's another private chat. Could those words enter Mara's correction?

1:34 Under the usual direct-message default, yes. Both select the agent's main history. That means one stored conversation for the agent. Its key names the agent and main, with neither sender's identity. Oh. “Same tests” might refer to somebody else's shortcut. Two chat windows can feed one conversation at the model boundary. Now change history selection to per-channel-peer. That setting includes channel and sender in the key. An operator might say, “I've given each person a private conversation. Why would they still share tool access?” The conversation setting doesn't separate tool authority.

2:10 Admitted people still share the agent's powers. Mara keeps this agent to herself. OpenClaw loads her conversation alongside the agent instructions and workspace context. So take our corrected call. The model requests node execution, device laptop-seven, the relative directory ledger, and the integration command. Her session permits that tool. The requested suite survived the trip through history. Next, the exec resolver permits our explicit node request under this auto setup. It resolves laptop-seven to a device ID, checks that it's connected and supports remote process execution, then sends a preparation request called system run prepare.

2:47 Prepare before approval? What does the laptop send back? A concrete execution plan. Our reply contains a shell argument list, the integration command text, and a canonical starting directory. The Gateway adopts those returned values. If the laptop can't prepare it, or sends a malformed reply, this request stops. So let's open that reply. The original folder was just ledger. Which machine turned that name into a full path? Now the laptop resolves that shorthand. For example, our node process starts in Mara's projects directory, so ledger becomes the folder inside it.

3:21 Mara checks the patch at that returned path. There's our moved validation call. And the command? The argument list names the Mac's standard shell, the flag to execute a command, then `pytest tests/integration` as one string. This path uses a non-login shell, because login startup files could run unapproved code before the payload. Ah, I didn't realize OpenClaw's non-login choice served the approval boundary. Startup code could do work Mara never approved. We now have the test command, its shell, and the laptop's ledger directory together.

3:54 Before analyzing that prepared command, the Gateway uses an empty executable search path for its local precheck. It cannot see the laptop's search path. Wait, a command precheck deliberately discards environment information? The local information could mislead it. Finding pytest on our server says nothing about the executable that laptop-seven will find. The precheck analyzes the prepared shell payload. Command rules it checks come from the laptop's approval snapshot. The server's pytest would give us another reassuring answer about the wrong computer. Even the precheck has to respect where execution will happen.

4:30 Now the Gateway combines its policy with the node's known policy. It takes the more restrictive security setting and stronger requirement to ask. Our server would allow without asking; the laptop requires a decision each time. Show me what Mara approves. Our prompt names laptop-seven, the prepared integration command, and that laptop ledger folder. The registered request also carries agent and session context. Mara chooses allow once. Her grant is ready. Does policy stay frozen while she decides?

5:00 No. The helper checks current Gateway policy again just before dispatch. Suppose an operator blocks node execution while Mara is deciding. Her approval can't override that new block. Our policy stays unchanged, so dispatch goes ahead. Next, dispatch sends the prepared plan and grant to laptop-seven. We can match the values: the same shell argument list, the same integration command string, and the ledger directory under Mara's projects. Not the server's ledger folder, and not the unresolved name from the model's call.

5:30 Right. Dispatch takes its starting directory from the node's reply. The Mac shell now runs our integration suite there. We've reached the process Mara wanted. When its result comes back, does the assistant receive the whole tool object we can inspect? Once the result returns, only part reaches the model. Structured details are UI and runtime metadata; they're stripped before replay. The node formatter puts device identity in ordinary text. Ours begins “Node: laptop-seven,” followed by process output.

6:00 Wait, the device field can be on our screen and absent from the next model turn? Yes. The source comment says the model needs the execution target in content. Repeating it in text keeps that fact across the boundary. I didn't realize that. I was assuming whatever we could inspect was also evidence for the assistant. We can inspect a field and forget to ask whether the model gets it. And the failure must survive too. The formatter combines output with an explicit nonzero-exit note when applicable; a timeout gets its own explanation.

6:32 Reassuring lines printed before failure mustn't become a success report. Our invented run returns exit code one. It identifies laptop-seven, then reports that the integration case for a retry after rejection failed. Finally, a useful red result. Mara can hold the release and investigate. Her assistant has evidence from the patched laptop checkout. The earlier green still describes the server's older files. So checking the selected device wasn't enough. Preparation resolved the folder, and policy was checked again before dispatch.

7:03 Then the result formatter determined which execution facts reached the assistant. That's the question I'd carry into another agent runtime: what survives from the process result into the model's next decision? Thanks for listening to Learning Podcasts.