Skip to content

fix(acp): instruct model to treat ACP attached-file blocks as inline context - #57509

Closed
NakePranob wants to merge 1 commit into
NousResearch:mainfrom
NakePranob:feat/acp-system-prompt
Closed

fix(acp): instruct model to treat ACP attached-file blocks as inline context#57509
NakePranob wants to merge 1 commit into
NousResearch:mainfrom
NakePranob:feat/acp-system-prompt

Conversation

@NakePranob

Copy link
Copy Markdown

Description

When the ACP adapter (Zed editor) sends @-tagged files to the model, the file content is inlined as [Attached file: <name>] text blocks. Without explicit instruction, LLMs treat these blocks as ordinary text and may attempt to fetch the file via tools instead of reading the content already present in the conversation.

This PR adds a one-line instruction to the agent's system prompt telling the model to read [Attached file: ...] blocks directly as file context.

Changes

  • agent/system_prompt.py — add instruction for ACP attached-file blocks

1 file, +7 lines.

Related issues

…context

The ACP adapter inlines user-attached files as:
  [Attached file: <name>]
  URI: <path>

  <file content>

Models treat this as plain text rather than real file context and often
try to shell-fetch the file instead of reading the body already present
in the prompt. Add a short instruction in the stable system-prompt tier
so the model uses the inline content directly.
@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/acp Agent Communication Protocol adapter P3 Low — cosmetic, nice to have labels Jul 3, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #25611 (ACP embedded_context / resource-block extraction), #57510 (companion adapter compliance PR from the same author). This is the genuine one-line prompt tweak (unlike the closed #56742, which carried a full adapter overhaul under a similar title).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for splitting this into a focused ACP change. The underlying attachment format is present on current main: acp_adapter/server.py:315-356 produces [Attached file: ...] text context, while ACP sessions set platform="acp" at acp_adapter/session.py:617-623.

Problems

  • The new stable_parts.append(...) is unconditional, before the platform resolution at agent/system_prompt.py:417-451. It therefore changes every surface's system prompt, not only ACP.
  • [Attached file: ...] does not always mean a complete inline file: acp_adapter/server.py:233-242 emits it for link-only resources, and :285-311 emits it for binary omissions and read failures. Text may also be truncated at :295-301, so a blanket “do not call tools to fetch it” instruction can suppress useful fallback.

Suggested changes

  • Scope the hint to platform_key == "acp" through the existing platform-hint path.
  • State that the model should use the inline body when available, while honoring link-only, omitted, error, and truncation notices.
  • Add prompt-builder coverage for ACP-only inclusion and non-ACP exclusion.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) labels Jul 15, 2026

@GottZ GottZ 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.

This was generated by AI during triage.

Summary

Two PRs address the ACP attached-file behavior: #56742 combines the prompt hint with a broad ACP/CLI overhaul, while #57509 isolates the prompt change intended to make models consume inline attachment content. The focused diff in #57509 targets the reported model behavior, but its unconditional wording does not match the adapter’s link-only, omitted, failed-read, and truncated attachment cases.

Related pull requests

  • #56742 [closed] related — (+1024/-64) — superseded: This closed PR includes the same system-prompt hint as #57509 but also mixes in extensive ACP capability, resource-handling, plan-update, skill, CLI, test, and artifact changes; it remains relevant as the oversized source change that was split after contributor feedback into focused PRs including #57509.
  • #57509 related — (+7/-0) — keep open for revision: The focused system-prompt addition directly targets redundant tool fetching, but the contributor keep_open review correctly notes that the hint currently affects every platform and falsely treats every [Attached file: ...] block as complete inline content, despite link-only, omitted, read-error, and truncation paths in the adapter.

Duplicates

#57509 duplicates the system-prompt portion of closed #56742; #56742 is not a full duplicate because it also contains the broader ACP adapter and CLI changes later split into separate PRs.

Suggested consolidation

Revise #57509 rather than merge it as-is: scope the hint to ACP, instruct the model to use the inline body only when present while preserving fallback behavior for link-only, omitted, failed-read, and truncated content, and add ACP-only prompt-builder coverage. After those changes address the contributor keep_open review, merge #57509 as the focused fix; #56742 can remain closed as superseded.

Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 70 kB of PR diffs, 2 kB of issue/PR text, 3 kB of discussion (5 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

@NakePranob

Copy link
Copy Markdown
Author

ปิด PR นี้ตามคำขอ (no longer needed / cleanup)

@NakePranob NakePranob closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/acp Agent Communication Protocol adapter comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants