Native root filesystem returns stale data after a guest process overwrites an API-created file
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- rust, sqlite, typescript
- Área
- databases, operating-systems
Línea de trabajo
Comienza con crates/native-sidecar/src/filesystem.rs y las funciones de sincronización en crates/native-sidecar/src/execution/launch.rs; después inspecciona el plugin chunked_actor_sqlite. Ejecuta el vfs-consistency.nightly.test.ts existente y amplía la cobertura para un archivo creado mediante la API y sobrescrito por un proceso guest nativo. Se considera terminado cuando tanto las lecturas del sistema de archivos como la reapertura de la VM respaldada por SQLite devuelvan el contenido actualizado del guest.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
With a sidecar-native chunked_actor_sqlite root filesystem, a file created through vm.filesystem.writeFile() is not updated in the filesystem API view after /bin/sh overwrites it.
The shell sees the new content, while vm.filesystem.readFile() deterministically returns the old content. Disposing and reopening the VM with the same SQLite database also returns the old content, so the guest update is not persisted to the authoritative VFS.
Minimal reproduction
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { AgentOs } from "@rivet-dev/agentos";
const dir = await mkdtemp(join(tmpdir(), "agentos-fs-repro-"));
const sqlitePath = join(dir, "workspace.sqlite");
const sidecar = await AgentOs.createSidecar({ placement: "process" });
const vm = await AgentOs.create({
sidecar: { kind: "explicit", handle: sidecar },
database: { type: "sqlite_file", path: sqlitePath },
rootFilesystem: {
type: "native",
plugin: {
id: "chunked_actor_sqlite",
config: { namespace: "root", uid: 1000, gid: 1000 },
},
},
permissions: {
fs: "allow",
network: "deny",
childProcess: "allow",
process: "allow",
env: "allow",
binding: "deny",
},
});
try {
await vm.filesystem.mkdir("/workspace", { recursive: true });
await vm.filesystem.writeFile("/workspace/shared.txt", "before");
const proc = await vm.process.spawn(
"/bin/sh",
["-c", "printf after > shared.txt; cat shared.txt"],
{ cwd: "/workspace", output: { retainEvents: true } },
);
await vm.process.wait(proc.pid);
const events = await vm.process.getOutput(proc.pid);
console.log(events); // shell output contains "after"
console.log(
Buffer.from(await vm.filesystem.readFile("/workspace/shared.txt")).toString(),
); // actual: "before", expected: "after"
} finally {
await vm.dispose();
await rm(dir, { recursive: true, force: true });
}
Equivalent minimal sequence:
filesystem.writeFile("/workspace/shared.txt", "before")
process.spawn("/bin/sh", ["-c", "printf after > shared.txt; cat shared.txt"])
filesystem.readFile("/workspace/shared.txt")
shell stdout: after
filesystem API: before
Reproduction matrix
| Sequence | Result |
|---|---|
| API write -> API read | Correct |
| Shell create -> API read | Correct |
| Shell create -> Shell overwrite -> API read | Correct |
| API write -> Shell overwrite -> API read | Stale pre-overwrite content |
| API write -> Shell remove/recreate -> API read | ENOENT / not found |
The failure remains when:
- the replacement has a different byte length;
- waiting 100 ms before the overwrite;
- waiting 100 ms and touching the file after the overwrite;
- disposing and reopening the VM against the same SQLite file.
If the initial file is also created through a guest process (cat > file via stdin), subsequent guest overwrites are visible through filesystem.readFile().
Expected behavior
Host filesystem APIs and guest processes should observe the same VFS. After the process exits successfully, filesystem.readFile() should return after, and reopening the persisted VM should retain after.
This matches the filesystem architecture documentation:
Host-side APIs (
agent.writeFile,agent.readFile) enter the same VFS from the trusted side.
Suspected boundary
The behavior appears specific to native sidecar shadow-root reconciliation:
- API
WriteFileupdates the kernel VFS and mirrors it into the process shadow root. /bin/shupdates the shadow-root file successfully.- The process-exit shadow -> kernel reconciliation does not update the API-created inode in the authoritative VFS.
Likely relevant paths:
crates/native-sidecar/src/filesystem.rsmirror_guest_filesystem_shadow_after_call
crates/native-sidecar/src/execution/launch.rssync_process_host_writes_to_kernelsync_vm_shadow_root_to_kernelsync_host_directory_tree_to_kernel_inner
crates/native-sidecar/src/plugins/chunked_actor_sqlite.rs
The existing vfs-consistency.nightly.test.ts exercises the runtime test kernel, but does not appear to cover the combination of a native process shadow and chunked_actor_sqlite after an API-created file is overwritten.
Environment
@rivet-dev/agentos: reproduced on0.2.16-rc.1and0.2.16-rc.2- Node.js:
v22.22.2 - OS: Linux x86_64, kernel
6.6.98 - glibc:
2.38 - Root plugin:
chunked_actor_sqlite - Reproduction rate: deterministic across repeated runs
- Lenguaje dominante
- Rust
- Estrellas
- 4.7k
- Forks
- 263
- Merge medio
- 8 h 57 min
- PR fusionados (30 d)
- 30
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rivet-dev/agentos
-
Python edits to filesystem.writeFile-created files are reverted by shadow reconciliationPosiblemente ocupada @ankssjain la tomó hace 3 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
rivet-dev/agentos#2022 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 Medio día Aptitud para principiantes 32/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 66/100
rivet-dev/agentos#1994 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
Todos los issues de rivet-dev/agentos
Issues similares
-
defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
enhancement user-priority/P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día