CI staging, agent lifecycle, and OpenClaw integration#560
Conversation
📝 WalkthroughWalkthroughAdds host UID/GID propagation to guest flake rendering (local and remote resolution), fixture-binary override support for test artifacts, exposes relay/server artifacts in nix CI outputs, updates demo targets to microVM-based flows, and adjusts guest module ownership handling and related tests/infrastructure. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/pikaci/src/executor.rs (1)
1705-1720: Consider handling partial environment variable configuration.Currently, if only one of
REMOTE_MICROVM_HOST_UID_ENVorREMOTE_MICROVM_HOST_GID_ENVis set, the function silently falls through to SSH-based detection. This could be confusing if a user sets one but forgets the other.Consider either:
- Emitting a warning when only one is set, or
- Returning an error for partial configuration
💡 Optional: warn on partial configuration
fn remote_ownership_ids(remote_host: &str) -> anyhow::Result<(u32, u32)> { - if let (Ok(host_uid), Ok(host_gid)) = ( - std::env::var(REMOTE_MICROVM_HOST_UID_ENV), - std::env::var(REMOTE_MICROVM_HOST_GID_ENV), - ) { + let uid_env = std::env::var(REMOTE_MICROVM_HOST_UID_ENV); + let gid_env = std::env::var(REMOTE_MICROVM_HOST_GID_ENV); + match (&uid_env, &gid_env) { + (Ok(host_uid), Ok(host_gid)) => { return Ok(( host_uid .trim() .parse::<u32>() .with_context(|| format!("parse {REMOTE_MICROVM_HOST_UID_ENV}"))?, host_gid .trim() .parse::<u32>() .with_context(|| format!("parse {REMOTE_MICROVM_HOST_GID_ENV}"))?, )); + } + (Ok(_), Err(_)) | (Err(_), Ok(_)) => { + eprintln!("[pikaci] warning: only one of {REMOTE_MICROVM_HOST_UID_ENV}/{REMOTE_MICROVM_HOST_GID_ENV} is set; falling back to SSH detection"); + } + _ => {} }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/pikaci/src/executor.rs` around lines 1705 - 1720, The function remote_ownership_ids currently treats a partial environment config as if no envs were set; change it to detect when only one of REMOTE_MICROVM_HOST_UID_ENV or REMOTE_MICROVM_HOST_GID_ENV is present and return an explicit error instead of falling back to SSH detection. Update remote_ownership_ids to read each env separately, and if exactly one is Some(_) return an anyhow::Error (e.g., using anyhow::bail! or anyhow::anyhow!) indicating which variable is missing and that both must be set; otherwise continue with the current parsing logic when both are present or proceed to SSH when neither is set. Ensure error messages reference REMOTE_MICROVM_HOST_UID_ENV and REMOTE_MICROVM_HOST_GID_ENV so callers can act on the partial configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@crates/pikaci/src/executor.rs`:
- Around line 1705-1720: The function remote_ownership_ids currently treats a
partial environment config as if no envs were set; change it to detect when only
one of REMOTE_MICROVM_HOST_UID_ENV or REMOTE_MICROVM_HOST_GID_ENV is present and
return an explicit error instead of falling back to SSH detection. Update
remote_ownership_ids to read each env separately, and if exactly one is Some(_)
return an anyhow::Error (e.g., using anyhow::bail! or anyhow::anyhow!)
indicating which variable is missing and that both must be set; otherwise
continue with the current parsing logic when both are present or proceed to SSH
when neither is set. Ensure error messages reference REMOTE_MICROVM_HOST_UID_ENV
and REMOTE_MICROVM_HOST_GID_ENV so callers can act on the partial configuration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 20ea539c-294f-4d2a-8810-f1ed475bd076
⛔ Files ignored due to path filters (1)
nix/ci/pika-core-workspace/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
crates/pikaci/src/executor.rscrates/pikahut/src/component.rsflake.nixjustfilenix/ci/linux-rust.nixnix/ci/pika-core-workspace/Cargo.tomlnix/pikaci/guest-module.nixrust/tests/support/infra.rstodos/pikaci-staged-ci-plan.md
Resolve justfile conflict: keep both agent-demo and agent-pi/agent-claw recipes, deduplicate agent-microvm-chat. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@justfile`:
- Around line 1004-1011: The recipe agent-microvm currently manually sources
.env with a set -a / source .env / set +a block which re-exports and can
override caller-provided env vars; remove that conditional block so the recipe
simply keeps set -euo pipefail and calls ./scripts/demo-agent-microvm.sh {{ ARGS
}} (dotenv-load enabled earlier will already load .env without re-exporting),
making the behavior consistent with agent-microvm-acp and preserving caller
precedence.
| agent-microvm *ARGS="": | ||
| set -euo pipefail; \ | ||
| if [ -f .env ]; then \ | ||
| set -a; \ | ||
| source .env; \ | ||
| set +a; \ | ||
| fi; \ | ||
| ./scripts/demo-agent-microvm.sh {{ ARGS }} |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In just, when set dotenv-load := trueis enabled, are.envvariables already exported to recipes, and do environment variables passed tojusttake precedence over.env values?
💡 Result:
Yes.
- With
set dotenv-load := true,.enventries are loaded as environment variables (notjustvariables) and are available inside recipes/backticks via$VARIABLE_NAME. [1] - By default, existing environment variables win over
.envvalues..envonly overrides them if you explicitly enableset dotenv-override := true. [1]
So: env vars passed to just (e.g., FOO=bar just …) take precedence unless dotenv-override is set. [1]
Sources: [1]
🏁 Script executed:
head -20 justfileRepository: sledtools/pika
Length of output: 686
🏁 Script executed:
rg "agent-microvm-acp" justfile -A 5 -B 2Repository: sledtools/pika
Length of output: 853
🏁 Script executed:
sed -n '1004,1011p' justfileRepository: sledtools/pika
Length of output: 243
Remove the manual .env sourcing from this recipe.
Line 2 enables dotenv-load, so .env is already loaded before the recipe runs. The manual sourcing in lines 1006-1010 with set -a re-exports these variables inside the recipe, which changes environment variable precedence and can override caller-provided values—unlike agent-microvm-acp and the rest of the file.
♻️ Proposed simplification
agent-microvm *ARGS="":
- set -euo pipefail; \
- if [ -f .env ]; then \
- set -a; \
- source .env; \
- set +a; \
- fi; \
- ./scripts/demo-agent-microvm.sh {{ ARGS }}
+ ./scripts/demo-agent-microvm.sh {{ ARGS }}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| agent-microvm *ARGS="": | |
| set -euo pipefail; \ | |
| if [ -f .env ]; then \ | |
| set -a; \ | |
| source .env; \ | |
| set +a; \ | |
| fi; \ | |
| ./scripts/demo-agent-microvm.sh {{ ARGS }} | |
| agent-microvm *ARGS="": | |
| ./scripts/demo-agent-microvm.sh {{ ARGS }} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@justfile` around lines 1004 - 1011, The recipe agent-microvm currently
manually sources .env with a set -a / source .env / set +a block which
re-exports and can override caller-provided env vars; remove that conditional
block so the recipe simply keeps set -euo pipefail and calls
./scripts/demo-agent-microvm.sh {{ ARGS }} (dotenv-load enabled earlier will
already load .env without re-exporting), making the behavior consistent with
agent-microvm-acp and preserving caller precedence.
* pikaci: narrow staged workspaceDeps builder failure * pikaci: drop staged builder workaround * ops: codify linux-builder staged rust repair * Align staged Linux Rust lane with x86_64 builder * Cut staged Linux Rust execute lane to x86 microvm * Fix staged pika_core manifest population * Stage server and relay for remote guest tests --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements
Tests