Repository navigation
feat(herdr): forward pane identity env into box agent (#131) - #137
Merged
Merged
Conversation
The agent pane now forwards the pane's herdr identity (HERDR_SOCKET_PATH, HERDR_PANE_ID, HERDR_WORKSPACE_ID, HERDR_TAB_ID, HERDR_ENV=1) into the guest so the in-box agent's herdr hook attributes state to the right pane: - lilbox agent gains a repeatable, transient --env KEY=VAL flag (exec env only, never persisted sandbox config); the shim's ensure_box uses it. - The agent pane's attach command exports the same identity and brings up the guest unix->vsock relay listener (a box provisioned without a task never starts one). - HERDR_BIN_PATH is deliberately never forwarded (host path).
- attach-path socat keeps stderr (drop 2>&1), matching the Rust task path - parse_exec_env validates keys as [A-Za-z_][A-Za-z0-9_]* - README: identity env is forwarded at attach/exec time, not provision - test: HERDR_PANE_ID with a space round-trips through %q unsplit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final piece of the herdr relay chain (spike #127; #129 host vsock route, #130 guest socat listener). The herdr plugin's
agentpane now forwards the pane's herdr identity into the box, so the in-guest agent's herdr hook attributes agent state (working/blocked/done) to the right pane — the pattern from scott-the-programmer/vscode-devcontainers-herdr'sexec.rs, adapted for lilbox.Two paths, both covered:
lilbox agentgains a repeatable--env KEY=VALflag, applied as transient exec env on the guest agent exec (never persisted in the sandbox config, per the secrets-in-exec-env rule). The shim'sensure_boxpasses--envfor each set identity var.lilbox ssh ... -- sh -lc '... exec claude'. The shim now exports the identity in that remote command and — since herdr relay: socat unix→vsock listener in box image + agent launch #130 only wires the unix→vsock socat listener into the task launch — brings up the listener idempotently ([ -S "/home/arch/.config/herdr/herdr.sock" ] || socat ... &), keyed offHERDR_SOCKET_PATH.Forwarded:
HERDR_SOCKET_PATH,HERDR_PANE_ID,HERDR_WORKSPACE_ID,HERDR_TAB_ID,HERDR_ENV=1(whichever are set; absent vars are skipped). Deliberately not forwarded:HERDR_BIN_PATH— a host path, meaningless in the guest; the guest hook talks to the socket over vsock.Closes #131
Test plan
cargo test --locked— 151 unit tests incl. newparse_exec_envcases (pairs,=-in-value, malformed rejection)contrib/herdr/tests/run.sh— 44 assertions; new TEST=19 (agent action forwards all identity vars tolilbox agentargv + exports them on the attach path + starts the relay listener;HERDR_BIN_PATHnever forwarded) and TEST=20 (nothing forwarded when not under herdr). Harness now sanitizes ambientHERDR_*so it stays hermetic when run from a herdr-hosted session.cargo fmt,cargo check --locked,cargo clippy --locked --all-targets -- -D warnings— cleanherdr agent listwith correct pane association) — to be attempted by the maintainer post-merge.Architecture
New surface:
lilbox agent --env KEY=VAL(repeatable). Why transient exec env and not config: AGENTS.md's rule that secrets/identity reach guests only via transient exec env, never the persisted sandbox builder config.run_guestgained anexec_env: &[(String, String)]param applied to both the attach and exec-stream paths; other callers pass&[]. No new config files, no persisted state.