3 Commits
Author SHA1 Message Date
Aleksander DygońandClaude Opus 5.5 53af9d8e5c Move leading tagged reasoning of OpenCode replies into the thinking steps (#17409)
* Move leading tagged reasoning of OpenCode replies into the thinking steps

Some models that OpenCode runs through a proxy or custom provider send
their reasoning inside the answer text, between <think> or <thinking>
tags. OpenBot showed the tags and the reasoning in the reply.

The ACP client now holds the start of each OpenCode answer message. When
the message starts with a closed <think> or <thinking> block, the block
goes into the collapsed thinking steps and the reply shows only the text
after it. A tag split between chunks is handled. A block that never
closes is shown as the answer, at the end of the message or turn, before
the empty-answer check. The background replay compare and the history
replay keep the same split. Other providers do not change.

Council vote: option A (OpenCode only, start of each message), scores
8, 7 and 8. The stray "****" marks and the repeated progress notes in
the report are not fixed by this change.

Fixes #16943

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Start a new reasoning check after each released OpenCode message

The leading-thought splitter changed to pass-through mode when the app
released it at the end of a message, also when it held no text. After a
tool step with no answer text before it, or after a stream error, the
message was empty, so the app did not start a new splitter. A <think>
block in the next answer then showed in the reply.

Now each release starts a new splitter. A stream error also drops the
held part of an unfinished reasoning block, so its raw tags do not show
as a step. The E2E script covers a tool step before the answer and a
stream error inside a reasoning block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the growth of a background OpenCode answer while its reasoning is held

In a background turn, OpenCode text comes only from session loads. When
a load ended inside a leading <think> block, the held text did not set
the message ID of the answer. The next load then had no message to
compare, so the rest of the answer was lost, and the turn ended with
the raw "<think>" text as the reply.

Now, while the splitter holds text, the background compare uses the
message ID of the splitter and adds the answer text of that message
only when it is the same message. The background-turn E2E script has a
tagged answer that grows across loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop a held reasoning block when OpenCode retries an attempt

The attempt retry from main (#19704) did not start a new leading-thought
splitter. When a failed attempt left an unclosed <think> block, the
next attempt released it into the reply, with its tags.

Now the retry drops the held part of the failed attempt, as the stream
error path does. The E2E script has a retried attempt with a cut
reasoning block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Attach a steer to the reply whose reasoning block is held

While an OpenCode message held its leading <think> block, the turn
still named the earlier message as the open reply. A steer in that time
marked the earlier message as the steered reply. The held message,
written before the steer, then showed below the steer, and the answer
to the steer joined it.

Now the open reply is the message of the splitter while it holds text.
The OpenCode steer E2E has a reply with an open thinking block at the
steer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:03:25 +01:00
Aleksander DygońandClaude Opus 5.5 03c2ff34c2 Remove code comments and add the no-comments rule (#12604)
* Remove code comments and add the no-comments rule

Remove the comments from first-party code and configuration files:
TS/JS, JSX, CSS, SQL migrations, Swift, Kotlin, Gradle, shell,
Docker, systemd, Nix, YAML, TOML, JSONC and GritQL.

Keep only what a tool reads: license headers, shebangs, compiler
and lint directives, JSDoc types in plain .js files, generated file
headers, GritQL scope lines, the install-server.sh help text and the
openbot-boat-pre-stop marker. Vendored code, fixtures and released
schemas keep their comments.

Add the rule to AGENTS.md, and change the docs that asked for
comments. Add two i18n keys that only comments named to
RELEASED_SOURCE_KEYS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep comments that are data in strings

The benchmark task files in opencode-free-models-bench.ts tell the
model what each function must do. The sample file and HTML page in
the two stories are display content. Put their comments back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep released migrations and mobile native inputs unchanged

check:migrations compares each released migration with v0.73.0 byte
for byte, so restore src/backend/migrations. A change to a native
build input of apps/mobile makes a new runtime version, so restore
those files and the extra fingerprint sources.

List these files and the comment markers that a tool reads in
AGENTS.md. Remove the last requests for comments in
src/renderer/AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 12:19:28 +01:00
Aleksander DygońandClaude Opus 5.5 168cb1198d Keep an OpenCode answer whole when reasoning streams between its tokens (#3361)
* Keep an ACP answer whole when reasoning streams between its tokens (#3351)

A thought chunk closed the open answer as commentary. A model that streams
its reasoning between the tokens of one answer (seen on a custom OpenCode
endpoint) had its answer cut mid-word into commentary items, so words showed
with a space inside them, such as "B aca". A thought no longer closes the
answer. A tool call or the end of the turn still sets its phase.

Add scripts/opencode-token-stream-e2e.ts: it runs the real OpenCode CLI and
driver against a fake OpenAI-compatible endpoint that streams sub-word
tokens, with and without reasoning between them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Limit the whole-answer rule to OpenCode and keep the harness retry path

Review findings on #3361:
- The harness error report (#1471) needed #appendThought to end the partial
  answer. That branch now ends it itself, so the retried answer replaces it.
- A thought keeps the answer open only for the OpenCode flavor
  (thoughtsInsideAnswer). Other ACP agents keep the old step boundary, so the
  Antigravity failure check on the answer text is not changed.
- Add a fake OpenCode agent and opencode-thought-interleave-e2e to the
  provider fakes CI job. It covers interleaved thoughts and the harness retry.
- The token stream control case now checks the answer text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:48:48 +01:00