WasmVM brush-shell: `>>` append truncates and `< file` stdin redirection fails

オープン
#1,657 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
rust, shell, typescript, wasm

調査の方向性

まず、提供された pnpm コマンドで packages/runtime-core/tests/integration/bridge-child-process.test.ts を実行し、失敗している append と stdin-redirection のケースを調査します。次に、WASI パスとリダイレクトのサポートについて、関連する toolchain/std-patches/crates/brush-* の領域を読みます。append が既存の内容を保持し、cat < stdin-input.txt が VFS ファイルの内容で正常終了すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

Two shell-redirection behaviors are broken in the WasmVM guest shell
(brush-shell), surfaced by the runtime-core integration suite:

  1. Append redirection (>>) truncates instead of appending.
  2. Stdin redirection (cmd < file) fails with a non-zero exit.

Both diverge from Linux/POSIX shell semantics.

Failing tests

packages/runtime-core/tests/integration/bridge-child-process.test.ts

Test Expected Actual
execSync append redirection onto a write-only file succeeds like Linux file contains originalchanged (append) changed — the >> truncated the file instead of appending
execSync stdin redirection feeds the kernel VFS file to the command cat < stdin-input.txt exits 0 with the file contents Error: Command failed: cat < stdin-input.txt, exit code 1

Exact assertion output:

× execSync append redirection onto a write-only file succeeds like Linux
  → expected 'changed' to be 'originalchanged' // Object.is equality

× execSync stdin redirection feeds the kernel VFS file to the command
  → stdout:
    Error: Command failed: cat < stdin-input.txt
    : expected 1 to be +0 // Object.is equality

Repro

# build/vendor the WASM commands, then:
pnpm --filter @rivet-dev/agentos-runtime-core exec vitest run \
  tests/integration/bridge-child-process.test.ts

The tests route child_process.execSync(...) through the bridge → kernel →
WasmVM sh (brush-shell), so the failures are in the guest shell's handling of
>> and <, not in the Node bridge.

Suspected root cause

  • >>: the append open-mode is not honored against the kernel VFS — the
    file is opened truncating (O_WRONLY|O_TRUNC) instead of appending
    (O_WRONLY|O_APPEND). Related patched area:
    toolchain/std-patches/crates/brush-* (WASI path/redirection support).
  • < file: input redirection from a VFS path is not wired to the command's
    stdin, so cat reads nothing and exits non-zero.

Not a regression

These predate and are unrelated to the registry→software flatten/colocation
refactor. Verified: the failing test file is unchanged, the vendored
runtime-core/commands binaries the test runs are unchanged, the brush-shell
source patches only moved (0 content delta), and the only runtime-core source
change is a moot commands-dir path string. The failures reproduce identically on
the parent revision.

Impact

Any guest program relying on >> append or < stdin redirection behaves
incorrectly (silent data loss on append; command failure on stdin redirect).

Related (separate issue)

The same integration run also has a WasmVM signal/dispose cluster — SIGKILL/
SIGTERM not terminating guest processes and dispose timing out
(signal-forwarding.test.ts, dispose-behavior.test.ts). Distinct root cause
(process signal delivery, not shell redirection); should be tracked separately.

主要言語
Rust
スター
4.8k
フォーク
275
平均マージ
13時間 37分
マージ済み PR(30日)
48

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rivet-dev/agentos のほかの issue

rivet-dev/agentos の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。