Repository navigation
fix(agents): name the real inbound media path for exec (ENG-19208) - #304
Merged
Merged
Conversation
The agent had no way to turn a media://inbound/<id> ref into a real path, so an exec-run CLI like boon-projects upload got called with an empty path first, failed, then the agent listed the inbound dir to recover before retrying. Add an Attachments system-prompt section stating the real inbound media directory (sandbox-relative when sandboxed) and the media:// mapping, with a concrete example and read/pdf/exec tool guidance. Also corrects the now-stale leak-prevention comment in media-note.ts and documents the new section in docs/concepts/system-prompt.md. Co-Authored-By: Claude Opus 5 <[email protected]>
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 4 files
Linked issue analysis
Linked issue: ENG-19208: Boon Agent calls boon-projects upload with an empty file path before resolving the staged file location
| Status | Acceptance criteria | Notes |
|---|---|---|
| Resolve inbound attachment refs before CLI uploads | The Attachments section maps refs to usable paths, but no live agent run proves uploads skip the empty-path call. |
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
View guided diff | Turn on auto-fix | Re-trigger cubic
Remove ticket references from source comments and a test title, trim an over-long incident narrative back to the invariant it protects, note the sandbox-relative path form in docs/concepts/system-prompt.md, and state that chat-history/reply-chain refs URL-encode <name> and must be decoded before use with exec. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
LGTM. Reviewed at commit cfe4c3fccfeae3205f33f209a5f8510d4a584a4f.
- Correctness:
buildAttachmentsSectionproperly resolvesmedia://inbound/<name>to${inboundMediaDir}/<name>, using sandbox-relativemedia/inboundfor sandboxed runs and host-absolute path for host runs, matchingstage-sandbox-mediaandmedia/store. - Tool guidance: Dynamically gates
read/pdf/execinstructions based on tool availability. - Prompt modes: Cleanly omitted in
minimalandnonemodes. - Review adjudication: All Cubic review items addressed in
cfe4c3fccfe(URL-encoding clarification, sandbox doc updates, comment cleanup). All review threads resolved. - Verification: 138 unit tests passed locally (
src/agents/system-prompt.test.ts,src/auto-reply/media-note.test.ts, prompt composition suite),run-tsgo.mjsclean, 0 runtime import cycles. All GitHub CI checks green.
orswn
approved these changes
Oct 21, 2026
convyusboy
added a commit
that referenced
this pull request
Oct 26, 2026
* chore(release): bump version 2026.6.35-boon.1 -> 2026.6.35-boon.2 Cuts the fork release covering the 9 PRs merged to boon since v2026.6.35-boon.1: #298 (ENG-21265) stuck-generation cut-off retry + sub-agent spawn backstop, #299 workspaceDir threading through outbound channel media adapters, #304 (ENG-19208) real inbound media path in the system prompt, #301 (ENG-21585) forced sessions_yield on narrated sub-agent turns, #305 message-tool source reply observed outside message_tool_only, #306 (ENG-19103) reasoning-stream callbacks honor message_tool_only, #303 sub-agent/completion-turn usage attribution, #302 clears 7 high-severity pnpm-audit-prod advisories, #300 (ENG-21588) boon-estimation trajectory label detail. Bump root package.json/npm-shrinkwrap.json, all bundled plugin manifests, and the version + openclaw peer floor in every extension npm-shrinkwrap.json. Add the 2026.6.35-boon.2 CHANGELOG.md section. No additional dependency or source changes beyond what already shipped in #299 and #302. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(changelog): fold PR #309's advisory fixes into the 2026.6.35-boon.2 entry --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
On the first turn where a user uploads a file and asks Boon Agent to do something with it through an external CLI (for example
boon-projects upload), the agent would call the CLI with an empty file-path argument, get a failure, then list the inbound media directory itself to find the real path before retrying. That wasted anexecstep against the fixed per-turn step budget and was caught by theelectrical-e2e-takeoffregression scenario (ENG-18813).Linear: https://linear.app/getboon/issue/ENG-19208/boon-agent-calls-boon-projects-upload-with-an-empty-file-path-before
Why This Change Was Made
The agent only ever saw an opaque
media://inbound/<id>reference for an uploaded attachment — OpenClaw deliberately rewrites the real absolute inbound-media path to that token before it reaches the model (src/auto-reply/media-note.ts), and nothing in the system prompt explained what the token meant or where the file actually lives on disk. This adds a small, cache-stable "Attachments" section to the agent system prompt (src/agents/system-prompt.ts) stating the real inbound media directory (the sandbox-relative form when running sandboxed, since the absolute host path would not resolve inside a sandboxedexec) and themedia://inbound/<name>-> path mapping, with a concrete example, so the agent can produce a real path forexec/CLI tools instead of guessing an empty one.The per-turn opaque ref itself is intentionally unchanged: it keeps the per-turn note compact/deterministic across hosts, and
boon-pdf-prep's ref parsing depends on that exact scheme. Only the now-stale "so prompts do not leak host paths" comment inmedia-note.tswas corrected to point at this new explanation instead of claiming secrecy that no longer holds.Scope is intentionally openclaw-only. Several
boon-skillsSKILL.md files (boon_projects,boon_takeoff_workflow,boon_costing) carry hand-written warnings against the same empty-path mistake; those stay as-is as a separate, deliberately deferred follow-up rather than being touched in this change.User Impact
Boon Agent no longer burns a wasted
execcall (and the user-visible "steps didn't finish" partial-failure note that can come with it) on a normal single-attachment upload turn. Not yet shipped/released.Evidence
Run from this worktree with the Codex-worktree-safe
nodewrappers (not rawpnpm test/pnpm check), per this repo'sAGENTS.md:node scripts/run-vitest.mjs <touched + adjacent files>— 214 tests passing across 16 files:src/agents/system-prompt.test.ts(93, including 4 new tests for the real-path rendering, pdf-tool gating, sandbox-relative form, and minimal-mode omission),src/agents/prompt-composition.test.ts/src/agents/system-prompt-stability.test.ts,src/auto-reply/media-note.test.ts/src/auto-reply/reply.media-note.test.ts/src/auto-reply/reply/prompt-prelude.test.ts, and every other test file that importssystem-prompt.js(bootstrap-budget,attempt-system-prompt,attempt.media-hint-cache-boundary,embedded-agent-runner/system-prompt,heartbeat-system-prompt,sanitize-for-prompt,subagent-initial-user-message,system-prompt.memory,commands-export-session,commands-system-prompt).node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental ...— clean.npx oxfmt --writeon the touched files — no diff.node scripts/run-oxlint.mjson the touched files — clean.node --import tsx scripts/check-import-cycles.ts— 0 runtime value cycles (relevant: this PR swapsmedia/store.js'sgetMediaDirfor the lighterresolveConfigDirfrom../utils.jsto avoid pullingmedia/store.js's http(s)/ssrf/file-store import graph into every system-prompt build).autoreviewskill fallback policy, an independent reviewer subagent reviewed the full diff with the task context. No P0/P1 findings. All P2/P3 findings were addressed in this PR: the stalemedia-note.tscomment, thedocs/concepts/system-prompt.mdStructure/Prompt-modes lists, the heavier-than-necessary import, an over-broad test assertion, and wording that over-claimed where every attachment lands on disk (remote-host attachments stage elsewhere and were out of scope).Known proof gap: this PR has no live/agent-regression proof that a real turn now skips the empty-path
execcall (for example by re-running theelectrical-e2e-takeofforchat-attachment-readbackagent-regression scenarios). That live verification was explicitly deferred as a follow-up rather than run here, since dispatching Boon's live Agent Regression workflow is costly and was not requested for this change.🤖 Generated with Claude Code
Summary by cubic
Stops Boon Agent from burning a wasted
execcall on single-attachment turns: on the first turn with an uploaded file, the agent called an external CLI likeboon-projects uploadwith an empty file path, failed, then listed the inbound media directory to recover before retrying.Adds a cache-stable Attachments section to the system prompt (
src/agents/system-prompt.ts) that mapsmedia://inbound/<id>refs to their real on-disk paths, with a concrete example and tool guidance. When sandboxed, the section states the sandbox-relative form instead of the absolute host path. The guidance also notes that chat-history/reply-chain refs URL-encode<name>and must be decoded before use withexec. The per-turn opaque ref inmedia-note.tsis unchanged —boon-pdf-prep's ref parsing depends on its scheme — but its now-stale "don't leak host paths" comment is corrected, anddocs/concepts/system-prompt.mdis updated.ENG-19208issue exactly: the agent can now produce a real path before callingexec, instead of guessing an empty one.minimalprompt mode and when no pdf tool is available.boon-skillsSKILL.md warnings about the same mistake are deferred as a separate follow-up.Written for commit cfe4c3f. Summary will update on new commits.