Skip to content

fix(native-sidecar): keep guest writes to API-seeded files - #2070

Merged
eersnington merged 1 commit into
mainfrom
fix/shadow-sync-guest-writes
Oct 21, 2026
Merged

eersnington merged 1 commit into
mainfrom
fix/shadow-sync-guest-writes

Conversation

@eersnington

Copy link
Copy Markdown
Member

Fixes #2022 and #1901. Supersedes #2023.

Edits that Python or the shell made to a file created with filesystem.writeFile were silently reverted on the next API read, and a shell rm + recreate made the API read fail with ENOENT.

  • The sidecar copies the VM's host-side shadow into the kernel before API reads. It copied whenever the two sides differed, without knowing which side changed. Only Node writes updated the shadow (fix(native-sidecar): keep guest edits to host-written files across shadow sync #1981), so stale shadow bytes overwrote Python and shell writes, and a missing shadow file looked like a host-side deletion.
  • Each shadow inventory entry now records both sides as of the last reconciliation. A shadow change reaches the kernel only when the shadow changed and the kernel did not; otherwise the kernel wins. This covers every guest writer instead of adding a mirror per runtime.
  • Seeded bootstrap content with no baseline imports as before.
API-seeded file, then … main This PR
Python overwrite API read returns old bytes returns the edit
Shell overwrite API read returns old bytes returns the edit
Shell rm + recreate ENOENT returns the edit

The Python test helper is adapted from #2023 by @ankssjain.

Python and WASM/shell writes go only to the kernel VFS, so the VM root
shadow kept the bytes from filesystem.writeFile. The next shadow-to-kernel
sync saw the two sides differ and copied the stale shadow over the guest
edit, and treated a guest rm/recreate as a host deletion.

The shadow sync inventory now records a stamp for both sides at each
reconciliation. A shadow change reaches the kernel only when the kernel
node is unchanged since then, so every guest writer wins without a
per-runtime mirror. Seeded bootstrap content still imports as before.

Fixes #2022 and #1901. The Python test helper is adapted from #2023 by
ankssjain.
@railway-app

railway-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @eersnington does not have access to the Railway project.

In order to get automatic PR deploys, please add @eersnington to your workspace on Railway.

@github-actions

Copy link
Copy Markdown
Contributor

📟 Pip-Boy · b962e79

📦 Packages

Skipped: this PR doesn't change any published package.

🧹 Rust dependencies · cargo deny + cargo shear

check new in this PR fixed existing on base
advisories ✅ 0 0 25
licenses ✅ 0 0 0
sources ✅ 0 0 0
bans ✅ 0 0 0
unused ✅ 0 0 16

🦀 Binaries · publish Dockerfiles, --release

Base: main@8cc8f8b, the merge base.

artifact npm @latest base this PR Δ vs base
agentos-native-sidecar linux-x64-gnu 143.6 MB 143.6 MB 143.8 MB +206.6 KB (+0.1%)

⏱ Timing

job wall time slowest step
changes 34s checkout · 30s
zizmor 12s checkout · 4s
hygiene 54s checkout · 24s
native · linux-x64-gnu 14m00s Build with the publish Dockerfile · 13m36s
⏭ self-test — skipped
⏭ footprint — skipped
report 20s Write the comment and run summary · 7s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for b962e79: every job and step, with the sizes above attached. Run after CI finishes.

pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha b962e79f633dcc9e93bc0265e49602b8d138b6d4

Add --otlp <url> to send it to any OTLP/HTTP collector.

Agent instruction: From a rivet-dev/agentos checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.

@eersnington
eersnington merged commit 893d7fe into main Oct 21, 2026
14 of 15 checks passed
@eersnington
eersnington deleted the fix/shadow-sync-guest-writes branch October 21, 2026 19:38
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.

Python edits to filesystem.writeFile-created files are reverted by shadow reconciliation

1 participant