harness-pi skips .pi/SYSTEM.md with sandbox-just-bash
Bug
With HarnessAgent + createPi + createJustBashSandbox, /workspace/.pi/SYSTEM.md exists but is ignored, so Pi uses its default coding-assistant system prompt.
Cause
harness-pi scans the workspace with find -L, but just-bash returns:
find: unknown predicate '-L'
Because the command is piped, the overall exit code is still 0; the mirror silently receives no .pi files.
Expected
Project .pi/SYSTEM.md is mirrored and used, or session creation fails with the unsupported-command error.
Versions
@ai-sdk/[email protected]@ai-sdk/[email protected]@ai-sdk/[email protected][email protected]
Identify issue type
Identified as Bug
Confidence: High
Rationale
This is a concrete interoperability failure in existing AI SDK packages that produces incorrect behavior instead of using the project system prompt or surfacing the command error.
Evidence
- Using
HarnessAgent + createPi + createJustBashSandboxignores an existing/workspace/.pi/SYSTEM.md. harness-piinvokesfind -L, which just-bash rejects withfind: unknown predicate '-L'.- The piped command still exits successfully, silently preventing
.pifiles from being mirrored and causing the default system prompt to be used.
Bug Reproduction - AI SDK 7
Bug was reproduced.
Branch: main
PR: successful reproduction pull request
Details
- Pi is expected to replace its default prompt with project
.pi/SYSTEM.md; ignoring it causes the agent to operate without the project's required instructions. - The target branch matches the reported versions:
@ai-sdk/[email protected],@ai-sdk/[email protected],@ai-sdk/[email protected], and[email protected]. packages/harness-pi/src/pi-workspace-mirror.tsruns the scoped workspace scan usingfind -Linside a pipeline, allowing the unsupported-command failure to be masked by the pipeline's successful exit code.examples/ai-functions/src/reproduction/issue-18767-harness-pi-system-prompt.tsverifies the sandbox file exists, captures Pi's active prompt, and observes the default prompt instead of the expected custom marker.
Relevant Documentation
- https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/usage.md
- https://github.com/vercel-labs/just-bash
Bugfix - AI SDK 7
Created bugfix and opened PR: #18769
Root Cause
The workspace mirror used unsupported find -L commands inside a pipeline. just-bash reported find: unknown predicate '-L', but the pipeline exited successfully with no mirrored .pi entries, as confirmed by the replay's exact failure signal.
Summary
Replaced find -L enumeration with scoped recursive shell traversal that remains symlink-aware, added a patch changeset, and removed reproduction-only artifacts.
Testing
Added regression coverage simulating a sandbox that rejects find -L and verifying .pi/SYSTEM.md is still mirrored.
Bugfix updated - AI SDK 7
Updated PR: #18769
Root Cause
just-bash shell function variables were global, so recursive calls overwrote the caller's next_depth and made depth accumulate across siblings. The old walker exited 1 on a shallow tree with 101 siblings, while the corrected integration test passes.
Update
Scoped recursive walker variables with local declarations and added an actual sandbox-just-bash integration test covering 101 sibling directories, including the required test dependency and TypeScript reference.
Bugfix updated - AI SDK 7
Updated PR: #18769
Root Cause
The walker assumed globbing through a symlinked directory remained reliable, but just-bash could enumerate the symlink's immediate child while failing on deeper alias paths. A focused real-sandbox test reproduced the missing nested SKILL.md.
Update
The walker now resolves symlinks with readlink while retaining separate logical mirror and physical sandbox paths, reads files from the resolved source, bounds symlink cycles, and prioritizes command stderr on failure.
Bugfix updated - AI SDK 7
Updated PR: #18769
Root Cause
The shell walker tied cycle protection to recursive call depth, so an actual just-bash sandbox exhausted the recursion limit on a deeply nested but acyclic tree.
Update
Replaced recursive traversal and its fixed depth cap with an iterative work queue, while retaining explicit symlink resolution and ancestry-based cycle detection. No additional changeset was needed because the existing patch changeset covers the behavior.
Bugfix updated - AI SDK 7
Updated PR: #18769
Root Cause
The symlink resolver represented the filesystem root as an empty resolved path, then ${resolved:-/} converted it into a traversal source. A real just-bash regression failed with a cycle beneath .pi/sandbox/work/.pi, confirming root enumeration.
Update
Root-resolving configuration symlinks are now skipped before directory enumeration. Added real just-bash regression coverage; the existing changeset already covers the behavior.