Skip to content

fix(agents): name the real inbound media path for exec (ENG-19208) - #304

Merged
convyusboy merged 2 commits into
boonfrom
worktree-nifty-dancing-sunbeam
Oct 21, 2026
Merged

convyusboy merged 2 commits into
boonfrom
worktree-nifty-dancing-sunbeam

Conversation

@convyusboy

@convyusboy convyusboy commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

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 an exec step against the fixed per-turn step budget and was caught by the electrical-e2e-takeoff regression 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 sandboxed exec) and the media://inbound/<name> -> path mapping, with a concrete example, so the agent can produce a real path for exec/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 in media-note.ts was corrected to point at this new explanation instead of claiming secrecy that no longer holds.

Scope is intentionally openclaw-only. Several boon-skills SKILL.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 exec call (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 node wrappers (not raw pnpm test/pnpm check), per this repo's AGENTS.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 imports system-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 --write on the touched files — no diff.
  • node scripts/run-oxlint.mjs on the touched files — clean.
  • node --import tsx scripts/check-import-cycles.ts — 0 runtime value cycles (relevant: this PR swaps media/store.js's getMediaDir for the lighter resolveConfigDir from ../utils.js to avoid pulling media/store.js's http(s)/ssrf/file-store import graph into every system-prompt build).
  • Independent adversarial review: Codex CLI was installed but unauthenticated in this environment, so per this repo's autoreview skill 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 stale media-note.ts comment, the docs/concepts/system-prompt.md Structure/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 exec call (for example by re-running the electrical-e2e-takeoff or chat-attachment-readback agent-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 exec call on single-attachment turns: on the first turn with an uploaded file, the agent called an external CLI like boon-projects upload with 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 maps media://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 with exec. The per-turn opaque ref in media-note.ts is unchanged — boon-pdf-prep's ref parsing depends on its scheme — but its now-stale "don't leak host paths" comment is corrected, and docs/concepts/system-prompt.md is updated.

  • Engages the ENG-19208 issue exactly: the agent can now produce a real path before calling exec, instead of guessing an empty one.
  • The Attachments section is omitted in minimal prompt mode and when no pdf tool is available.
  • Scope is openclaw-only; boon-skills SKILL.md warnings about the same mistake are deferred as a separate follow-up.

Written for commit cfe4c3f. Summary will update on new commits.

View guided diff Turn on auto-fix

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]>
@convyusboy
convyusboy requested a review from a team October 21, 2026 15:49

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/agents/system-prompt.ts Resolved
Comment thread src/agents/system-prompt.ts Resolved
Comment thread src/agents/system-prompt.test.ts Resolved
Comment thread src/agents/system-prompt.test.ts Resolved
Comment thread docs/concepts/system-prompt.md Resolved
Comment thread src/auto-reply/media-note.ts Resolved
Comment thread src/agents/system-prompt.ts Resolved
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]>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/agents/system-prompt.ts Resolved

@boon-hermes-bot boon-hermes-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Reviewed at commit cfe4c3fccfeae3205f33f209a5f8510d4a584a4f.

  • Correctness: buildAttachmentsSection properly resolves media://inbound/<name> to ${inboundMediaDir}/<name>, using sandbox-relative media/inbound for sandboxed runs and host-absolute path for host runs, matching stage-sandbox-media and media/store.
  • Tool guidance: Dynamically gates read/pdf/exec instructions based on tool availability.
  • Prompt modes: Cleanly omitted in minimal and none modes.
  • 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.mjs clean, 0 runtime import cycles. All GitHub CI checks green.

@convyusboy
convyusboy merged commit d8e8ec6 into boon Oct 21, 2026
152 of 159 checks passed
@convyusboy
convyusboy deleted the worktree-nifty-dancing-sunbeam branch October 21, 2026 18:43
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]>
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.

2 participants