Skip to content

fix(cli): deduplicate multiline finish results - #689

Closed
agenteinstinct1-max wants to merge 2 commits into
dev-vibecodedfrom
arena/b4f609e2-silvercode
Closed

agenteinstinct1-max wants to merge 2 commits into
dev-vibecodedfrom
arena/b4f609e2-silvercode

Conversation

@agenteinstinct1-max

@agenteinstinct1-max agenteinstinct1-max commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Fixes #690.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Headless run printed a multi-paragraph final answer again inside the finish block, because the finish-block deduplication compared only the first paragraph of the previously printed text.

  • Compare the full previously printed text before locating a finish-block paragraph boundary, rather than comparing only the first paragraph.
  • Keep new finish details and the effort/review status, avoid stripping a mere prefix of a different result, and leave raw JSON events unchanged.
  • Cover the real headless CLI and the deduplication helper without changing timeout or retry policies.

How did you verify your code works?

Failing-first reproduction on d6107cf: bun run test test/cli/run-finish-dedupe.test.ts test/cli/run/run-finish-output.test.ts failed before the fix — the CLI had already printed the answer to stdout, but printed it again in the finish block:

Expected to not contain: "First paragraph of the answer.\n\nSecond paragraph of the answer."
Received: "...✓ Task completed\nFirst paragraph of the answer.\n\nSecond paragraph of the answer.\n\n[effort medium | review unreviewed/not-required, passes 0/2 | validation standard/incomplete]..."

The helper test also received undefined instead of the status line for the same multi-paragraph result.

After the fix:

  • Focused final regression tests: 11 passed (test/cli/run-finish-dedupe.test.ts, test/cli/run/run-finish-output.test.ts).
  • Headless CLI and helper suite: 66 passed across the above, entry.body, run-process, background-tasks, and retry-notice.
  • NODE_OPTIONS=--max-old-space-size=3000 bun typecheck in packages/opencode.
  • Prettier check and git diff --check.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant