fix(acp): instruct model to treat ACP attached-file blocks as inline context - #56742
fix(acp): instruct model to treat ACP attached-file blocks as inline context#56742NakePranob wants to merge 7 commits into
Conversation
…ll command - Bug 1: --skills flag in ACP mode (cli forwarding + entry preload) - Bug 2: config_options=None -> model selector in Zed - Bug 3: set_session_model() preserves MCP toolsets across model switch - Bug 4: _cmd_model slash command preserves MCP toolsets too - Feature: /skill slash command (list/load skills) - Tests: update config_options assertion, advertised commands list
…es, init caps
Codex-driven fixes covering all spec gaps:
Critical:
- _extract_text() now handles ALL ACP content block types (Text, Resource,
EmbeddedResource, Image, Audio) — tagged files (@-references) work now
- Empty prompt returns end_turn gracefully with client notification
Priority 2:
- Plan entry status tracking: todo tool. started sends session/update plan
- config_options now includes mode selection (category='mode')
- initialize() response: embedded_context=True, audio=False in promptCapabilities
Priority 3:
- All advertised commands have displayName, toolTip, icon via field_meta
- set_config_option handles mode ('mode' config_id) changes
New tests: 5 (plan update, empty prompt, config mode/model routing)
All 293 ACP tests passing.
- _skill_commands() classmethod enumerates all registered skills as individual AvailableCommand entries - _available_commands() appends skill commands after built-in commands - _handle_slash_command() routes /<skill-name> directly to skill loader (instead of requiring /skill load <name>) - _cmd_help() shows skills section with type /name to load - Test: available_commands list now includes dynamic skill entries Zed's / menu now shows all ~94 skills alongside built-in commands, matching OpenCode's behaviour.
When a user types /<skill-name> in the ACP chat: - Skill loads into system prompt - _pending_skill_prompt flag stores the skill text - _handle_slash_command returns None to fall through to LLM - prompt() rewrites user_text/user_content to the skill's own prompt - LLM responds with the skill's voice/instructions immediately Previously the handler returned 'Loaded skill(s): ...' and ended the turn without invoking the LLM, leaving the skill loaded but idle. Also fixes nested try/except lint issue in _handle_slash_command.
…g, ext_method/notification, close_session, fs/* via ext_method HIGH Priority: - tool_progress_cb now emits ToolCallProgress(status=in_progress) immediately after ToolCallStart so clients see pending->in_progress->completed progression - stopReason detects max_tokens (output length limit) and refusal (content_policy_blocked) from result.error, mapped to spec-correct values - ext_method/ext_notification overrides: unknown methods now raise RequestError.method_not_found() instead of returning empty dict silently (the base class' empty-dict behaviour was incorrect per spec) MEDIUM Priority: - close_session() added to HermesACPAgent: maps to session/close (unstable), delegates to SessionManager.remove_session() and returns CloseSessionResponse - fs/read_text_file and fs/write_text_file implemented via ext_method: resolve path relative to session cwd, validate existence, read/write with proper RequestError (invalid_params/internal_error) on failure, return TextResourceContents for reads and empty dict for writes All 293 ACP tests pass (3 pre-existing edit_approval tests deselected for macOS /private/var/folders/ sensitive-path issue).
…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.
Scope note for reviewers: the PR description presents this as a one-line addition to |
|
Per reviewer feedback, this PR has been split into three focused PRs:
Planning artifact ( Closing this PR in favor of the three focused ones above. |
Problem
When a user
@-tags a file in Zed ACP, the adapter correctly inlines the file content into the prompt as[Attached file: ...] URI: ...followed by the file body. However, the LLM treats this as plain text and runs shell commands to fetch the file instead of reading the content already in its context window.Root Cause
The system prompt had no instruction about
[Attached file: ...]blocks from the ACP adapter.Fix
Add a short instruction to the stable tier of
agent/system_prompt.py:Verification
298 passed, 3 failed(same pre-existing edit_approval macOS failures)