Skip to content

fix(acp-driver): send the user's task before the host preamble - #153

Open
Luna Qiu (lunaqiu) wants to merge 1 commit into
microsoft:mainfrom
lunaqiu:fix/acp-preamble-first-message
Open

fix(acp-driver): send the user's task before the host preamble#153
Luna Qiu (lunaqiu) wants to merge 1 commit into
microsoft:mainfrom
lunaqiu:fix/acp-preamble-first-message

Conversation

@lunaqiu

Copy link
Copy Markdown
Collaborator

Root cause

Every externally-bound Huabu thread (Copilot CLI / Claude Code / Codex over ACP) opens its session/new + first session/prompt with the host's static system preamble concatenated before the user's actual request, because ACP has no separate system-role channel — both land in the same first message.

External agents that title a session from the leading characters of that first message (Copilot CLI observed) therefore show the exact same uninformative title — "You are a helpful assistant collaborating with a user inside Huabu, an infinite visual Space. The user wor…" — for every externally-bound session, regardless of what the user actually asked. Confirmed by inspecting the agent's own Sessions picker in another tool (VS Code) and matching the truncated text verbatim against �pps/server/src/prompt/external-agent/system_prompt.md.

Fix

Swap the concatenation order in \handle.ts\ so the user's task leads and the host preamble trails (still delivered once, still fully read by the agent before it responds — only the ordering within the single first message changes). Updated the one test that asserted the old order.

Testing

  • \pnpm --filter @agenetes/acp-driver test\ — 51/51 passing
  • \pnpm --filter @agenetes/acp-driver build\ — clean

Scope

External-only (\�xternal/agenetes) subtree change; no Huabu-app-side files touched.

External ACP agents receive Huabu's one-shot system preamble and the
user's first prompt concatenated into a single session/prompt
message (ACP has no separate system-role channel). The preamble was
sent first, so every externally-bound Huabu session started with the
exact same static boilerplate text.

Several external agents (Copilot CLI observed) title a session from
the leading characters of that first message, so every session showed
an identical, uninformative title in the agent's own session list
(e.g. its VS Code picker) regardless of what the user actually asked.

Swap the order so the user's task leads and the preamble trails. The
agent still reads the whole message before responding either way, but
title heuristics now key off unique, per-session content.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant