Skip to content

fix: keep composer predictions focused on the next user message - #441

Merged
iililiiilili merged 1 commit into
mainfrom
fix/composer-upstream-alignment
Nov 4, 2026
Merged

iililiiilili merged 1 commit into
mainfrom
fix/composer-upstream-alignment

Conversation

@iililiiilili

Copy link
Copy Markdown
Collaborator

Related: #437

What Problem This Solves

Resolves a problem where Web chat users could see prediction-model commentary as ghost text instead of a proposed next user message. Short history prefixes also omitted useful follow-up context.

Why This Change Was Made

Selectively aligns Composer with OpenClaw upstream c4753809c7b151fdb40746c5ab534d5eb2caf1de: the exact prediction prompt, recent conversation serialized as task data in one fresh user message, a 160-token output budget, and a 500 UTF-16-unit display limit. The last eight visible user/assistant messages retain up to 2,000 Unicode code points each, preserving existing Unicode-safe slicing.

The existing public SDK transport builder owns request shaping and receives the leaf API's reasoning: "none"; explicit model compatibility metadata owns backend thinking fields. Its input types accept immutable model snapshots without cloning or dropping nested metadata. The existing reasoning-strip helper gains explicit hide mode to discard closed or unfinished tagged reasoning, while ordinary reply recovery stays unchanged. Original reasoning is classified before final-marker cleanup. Server/account opt-out is rechecked immediately before egress after DNS and lazy transport loading.

User Impact

Predictions receive more authorized recent context and use the common request/output paths. Model selection, Web/account/Space isolation, DNS-pinned private egress, redirect rejection, configured deadlines, immediate cancellation, and safe diagnostics remain intact. No dependency, config key, environment variable, database schema, protocol version, SDK subpath, or public SDK symbol is added.

Two existing input contracts expand: the reasoning helper's mode and immutable transport model inputs. Mutable model aliases and direct mutable compatibility-call returns remain supported; type-level overload introspection using ReturnType/Parameters can expose readonly views.

Unmarked explanatory prose returned as final content cannot reliably be classified as reasoning by a consumer. Company Fast/LiteLLM output quality, latency, and GPU cancellation still need company-side live validation.

Evidence

Validated on Linux against base c7c25287febcc4e75ee021c4fae716467a0fcc9c, final 18-path patch SHA-256 b50335979b2dd9ba1af34a22a45e0b29814ab0dc1f702272bf44bb87b8f85cde.

  • Structured autoreview passed: gpt-6.1-sol / xhigh, P0 threshold, zero findings, exit 0. Used existing ChatGPT authentication with the app-bundled CLI; API-key variables were removed. No model fallback or TruffleHog. The isolated review copy matched all final source hashes.
  • Canonical full build, SDK API/surface-budget checks, core production types, package-owner test types, fresh SDK-backed admin production/test types, all-extension production types, affected lint/structural gates, and all 18 files' formatting passed. SDK API baseline and export limits are unchanged. Exact selected plugin lint under oxlint.extensions.json also passed.
  • Final changed owner/Composer/index runtime: 88 passing tests. Tests cover frozen nested metadata, the open Api string union, mutable-call compatibility, and Responses. Unchanged siblings retain Linux evidence: 308 parser/reasoning tests, 197 AI/Completions/Responses/plugin cases, 771 UI tests, and 2,053 control-plane tests.
  • Fresh built-SDK HTTP proof passed with four real loopback requests: expected non-streaming/disabled-thinking payload, closed/unfinished tagged-reasoning handling, actual socket closure on abort, and admission recovery. Used a synthetic backend in a network-none container with read-only source/dependency mounts. Built-UI Chromium proof covered draft separation, Tab, Escape, typing, and synthetic Korean IME events.
  • Remaining local gaps: whole core-test and extension-test typechecks exhausted the local 5 GiB RAM + 1.5 GiB swap budget; both remain unproven and need larger supported Linux or hosted CI. No source diagnostic or unchanged-base explanation was established. The complete quick/full/check-changed aggregate is not claimed as passed. Company-model live proof is unavailable here.
  • Production net +119 lines, primarily immutable transport typing and canonical request/output ownership; tests +644; docs +25. Removed direct request assembly and divergent output filtering; no new SDK export.

Named follow-ups: shared bounded fire-and-forget completion delivery can leave admission busy when notification is dropped; managed transport and older provider metadata projection also differ. These belong to their shared lifecycle/transport owners and do not establish the company incident's cause.

AI-assisted implementation and description.

@iililiiilili
iililiiilili merged commit 0c813ee into main Nov 4, 2026
79 checks passed
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