fix(acp-driver): send the user's task before the host preamble - #153
Open
Luna Qiu (lunaqiu) wants to merge 1 commit into
Open
fix(acp-driver): send the user's task before the host preamble#153Luna Qiu (lunaqiu) wants to merge 1 commit into
Luna Qiu (lunaqiu) wants to merge 1 commit into
Conversation
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>
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.
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
Scope
External-only (\�xternal/agenetes) subtree change; no Huabu-app-side files touched.