Skip to content

fix(harness): correct the text layer for DreamCoder and non-Claude models - #287

Merged
GoDiao merged 1 commit into
mainfrom
fix/text-layer
Nov 18, 2026
Merged

GoDiao merged 1 commit into
mainfrom
fix/text-layer

Conversation

@GoDiao

@GoDiao GoDiao commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Part of #270. Sub-issues #271–#280 are not included.

What changed

Context and memory

  • Memory writes: the CLI's write carve-out for memory files now also covers the memory directory the server sets (CLAUDE_COWORK_MEMORY_PATH_OVERRIDE), so saving a memory no longer asks for approval, also in bypass mode.
  • Skill list: which skills were already listed is derived from the conversation history (skill_listing attachments now carry skillNames) instead of a per-process set. After compaction the full list is sent again in the post-compact attachments; when skill folders change only new skills are listed ("These skills are now also available…"); after a CLI restart nothing is resent. sentSkillNames, resetSentSkillNames and suppressNextSkillListing are removed.
  • First user message: the wrapper says the context was attached automatically and is not the user's message (no more "may or may not be relevant"); the instruction preface says the user's own messages take precedence; MEMORY.md moves out from under the instruction preface with its own note.
  • Subagents get the instruction files without the MEMORY.md index.

CLI restarts

  • The transcript keeps all attachments (isLoggableMessage drops only progress messages).
  • Stop ends the CLI only when the interrupt did not end the turn within 3 seconds (stopRequested is cleared by the CLI's result); otherwise the process phase goes back to running.
  • Resuming no longer inserts "Continue from where you left off." or a synthetic "No response requested." reply; the auto-resume path (CLAUDE_CODE_RESUME_INTERRUPTED_TURN) enqueues the continuation itself.
  • After a restart, nested instruction files already in the history are not attached again, and SessionStart(resume) output identical to the last one in the history is not appended again.

Text for the model in use

  • USER_TYPE === 'ant' text branches in the system prompt and tool descriptions are deleted (ant-only behavior code is untouched).
  • Text that arrives after a tool result stays a separate text block for non-Claude models (isClaudeModelName, moved to src/utils/model/claudeModelName.ts and shared with the server); Claude models keep the fold. Only the request to the model changes.
  • Cross-session and board envelopes carry one short no-authority sentence; unwrapping for display parses the tags, so transcripts with the old, longer notice still display correctly.
  • Environment section: the Claude model family, Claude Code products and /fast lines are removed for every model. When the app starts the CLI (DREAMCODER_DESKTOP_HOST=1), one line says it runs in the DreamCoder app.
  • # System and Tone no longer promise a monospace font or clickable links; /help and feedback point to DreamCoder.
  • Read: through the provider proxy the description says image and PDF contents do not reach the model; directly connected, it keeps the image text without naming Claude Code.
  • update-config: DreamCoder wording, no Config tool.
  • statusline-setup subagent and /statusline removed.

Behavior the text got wrong

  • Plan mode has one procedure: the plan-mode reminder's iterative workflow. The 5-phase workflow (required Explore/Plan subagents) and its plan-size experiment are removed, along with planModeV2.ts.
  • EnterWorktree/ExitWorktree describe the desktop behavior (no hooks, tmux or exit prompt; the desktop panels keep showing the original directory).
  • AskUserQuestion: the schema sent to the model drops answers, annotations and metadata, and drops preview unless the client renders previews (the terminal UI); the tool's own schema still accepts the desktop app's answer.
  • File-changed notice: neutral attribution, no "don't tell the user", snippet capped at 2 KB with a pointer to Read.
  • /goal now actually continues. The evaluator's "not met" result carried both a blocking error and a stop request; executeHooks yields them separately, so the stop request arrived without the goal marker and ended the turn at the first check. A /goal hook's unmet result now carries only the blocking error (unmetPromptHookResult), and the after-the-fact shouldLetGoalPromptHookContinue is removed.
  • /goal: the continuation message names the goal, what the evaluator says is missing and the count; at most 10 consecutive continuations per user message (counted in the query loop state, so compaction does not reset it), the 10th asks for a report.
  • /goal: the evaluator can answer that the agent is blocked on the user (blocked: true, added only to the prompt hook's own response schema). The turn then ends without a continuation and the goal stays active; other prompt hooks ignore the field.
  • Compaction requests decide the tool-result fold by model as well (compactRequestMessages).
  • Compaction summary: search the transcript with Grep instead of reading it whole. The server's summary card recognizes both the old and the new sentence.

Provider check for separate user messages after tool messages

Request: system → user → assistant (tool_calls) → tool → user (a <system-reminder> with a cross-session message), one function tool. 11 requests through OpenRouter:

Model Served by Result
openai/gpt-5-mini OpenAI 200, normal answer (2 requests; the first hit the 200-token limit during reasoning)
z-ai/glm-4.6 DeepInfra 200, normal answer
z-ai/glm-4.6 Z.AI (pinned) 429 upstream rate limit
deepseek/deepseek-chat-v3.1 CoreWeave 200, normal answer
moonshotai/kimi-k2-0905 Novita 200, normal answer
DeepSeek, Kimi, Qwen pinned to their own providers — 404, OpenRouter has no first-party endpoint for these models

The official GLM, DeepSeek and Kimi APIs were not tested.

How it was tested

  • Each behavior change has a test that failed before the change.
  • bun test --randomize --seed=1 on the 27 changed test files: 185 pass.
  • src/query/goalContinuationLoop.test.ts drives the real query loop through QueryEngine (model calls, Stop hook execution and auto-compaction replaced): continuations are numbered 1 to 10 across a compaction and the turn ends after the 10th; a blocked answer ends the turn and keeps the goal.
  • Full bun test: the same 11 failures as on main (environment-dependent: ripgrep, inherited Claude Code customizations, agent cache, slash-command listing), nothing new.
  • desktop/ is not changed.

Not in this PR

  • At the 10-continuation cap, the evaluator's last "not met" reason is not shown to the user; agreed as a separate follow-up.
  • Session-start context (git status, instruction files, date) as history attachments: separate issue.
  • While a session is in a worktree entered mid-session, the desktop panels keep showing the original directory.

…dels

Part of #270. Memory writes in the server's memory directory no longer
ask for approval; the transcript keeps all attachments and Stop ends the
CLI only when the turn did not stop; the skill list is derived from the
history; resuming adds no synthetic messages; internal-build-only text is
removed; non-Claude models get mid-turn text as separate blocks; the
environment, help, Read, update-config, worktree, plan mode, AskUserQuestion,
file-changed and compaction texts describe DreamCoder; /goal continues,
caps at 10 continuations and stops when blocked on the user.
@GoDiao
GoDiao merged commit 052a0e6 into main Nov 18, 2026
4 checks passed
@GoDiao
GoDiao deleted the fix/text-layer branch November 18, 2026 15:22
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