Skip to content

Fix guest-agent PTY source packaging - #98

Merged
thrashr888 merged 2 commits into
mainfrom
codex/fix-guest-agent-pty
Aug 1, 2026
Merged

Fix guest-agent PTY source packaging#98
thrashr888 merged 2 commits into
mainfrom
codex/fix-guest-agent-pty

Conversation

@thrashr888

Copy link
Copy Markdown
Owner

Summary

  • embed the guest-agent PTY source in the published agentkernel crate
  • materialize src/pty.rs alongside main.rs in a fresh setup build context
  • add regression coverage for declared module staging and canonical/embedded source parity

Root cause

agentkernel setup assembled a temporary guest-agent crate containing only Cargo.toml and src/main.rs. PTY support added mod pty; to main.rs, but the corresponding src/pty.rs was never added to that build context, causing Rust error E0583 during rootfs setup. Podman's Docker emulation exposed the same source-packaging defect as Docker.

Impact

Firecracker setup can compile the embedded guest agent again from packaged releases. Fresh temporary build directories also prevent stale files from masking future source-packaging omissions.

Validation

  • cargo fmt --all -- --check
  • cargo test (full non-ignored suite)
  • focused setup and embedded-source regression tests
  • cargo package --allow-dirty
  • clean temporary embedded guest-agent crate: cargo check
  • Clippy passes with only Rust 1.97's two pre-existing unnecessary_sort_by lints in src/stats.rs scoped out; project CI is pinned to Rust 1.89

Closes #60

Tracked locally as agentkernel-ajsk.

@thrashr888
thrashr888 marked this pull request as ready for review August 1, 2026 22:48
Copilot AI review requested due to automatic review settings August 1, 2026 22:48
@thrashr888
thrashr888 merged commit 76e64e9 into main Aug 1, 2026
12 checks passed
@thrashr888
thrashr888 deleted the codex/fix-guest-agent-pty branch August 1, 2026 22:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes agentkernel setup guest-agent build failures by ensuring the PTY module source is packaged/embedded and always materialized into a fresh temporary guest-agent build context, preventing missing-module errors (E0583) and avoiding stale-file masking.

Changes:

  • Embed the guest-agent PTY source (src/embedded/guest_agent_pty.rs) and teach setup to stage it into the temporary build context.
  • Refactor guest-agent build-context creation into write_guest_agent_build_context() and switch to tempfile::tempdir() for a clean per-run directory.
  • Add regression tests for embedded-vs-canonical source parity and for module materialization in the staged build context.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/guest_agent_embedded_sources.rs Adds an integration test asserting canonical guest-agent sources match embedded copies.
src/setup.rs Writes a clean embedded guest-agent crate build context (now including src/pty.rs) into a tempdir before Docker build; adds a unit test for module staging.
src/embedded/guest_agent_pty.rs Adds the embedded PTY implementation used when staging the guest-agent build context.
Cargo.lock Updates lockfile entries (including security-motivated dependency bumps referenced in PR metadata).
.beads/issues.jsonl Records/updates locally tracked bd issues related to this work.
.beads/export-state.json Updates bd export state metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +137 to +141
// Create async file wrapper for the master fd
let master_fd = master.as_raw_fd();
let master_file = unsafe {
std::fs::File::from_raw_fd(master_fd)
};
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.

Rust compilation error when compiling agent-kernel-guest v0.1.0

2 participants