Skip to content

fix: prevent duplicate manager replies during background tool work - #19

Open
Jerins71 wants to merge 1 commit into
a-mart:mainfrom
Jerins71:codex/fix-background-reply-duplication
Open

Jerins71 wants to merge 1 commit into
a-mart:mainfrom
Jerins71:codex/fix-background-reply-duplication

Conversation

@Jerins71

Copy link
Copy Markdown
Collaborator

Problem

A manager reply can appear twice while a background tool remains active. The progress tracker treats a clean message_end as progress solely because another tool is open, then the final projector publishes the same message as assistant_output. These are distinct persisted conversation entries, so this is not a repeated WebSocket delivery or renderer-only issue.

Text-only streamed updates can enter the same premature-progress path before their final/progress classification is known.

Change

  • Reuse the existing clean-final classifier to leave completed replies exclusively to the final projector.
  • Hold provisional text-only progress during open tool work until a message boundary or attached tool work confirms it is progress.
  • Preserve genuine tool-use progress, background execution/settlement, and legitimate identical replies in later turns.

One production file and two test files; 112 additions and 3 deletions. No new protocol fields, state owner, UI deduplication, provider adapter, or persistence migration. Previously saved duplicate entries are not rewritten.

Regression evidence

Prepared from public main 07d6c2990f21f9c693469492a7ab056a0933abec; only this fix is included.

Tests were written before the corresponding production changes. Unmodified public code failed the new clean-final regression cases; additional streaming regressions failed before the provisional-publication correction. The corrected tests verify streamed/non-streamed output, with and without prior progress, through real conversation publication and persistence. They assert live delivery, background completion and settlement, fresh history reload, and preservation of a subsequent identical reply.

Validation

Validated on macOS arm64 with repository-pinned Node 26.5.0 and pnpm 10.30.1:

  • pnpm install --frozen-lockfile
  • pnpm quality:full: all 8 checks passed; 9,334 tests passed and 33 conditional tests skipped. Includes lint, clean-checkout Knip, rollback-runner provisioning, all workspace tests/typechecks, strict help validation, Docker context safety, and production build.
  • Focused five-file run: 177 tests passed, including manager output tracking, runtime projection, conversation persistence, native Claude runtime, and real Claude-process command-steering/scheduled-wakeup acceptance against an isolated local model fixture.
  • Explicit contribution typechecks: backend pnpm exec tsc -p tsconfig.build.json --noEmit and UI pnpm exec tsc --noEmit.
  • git diff --check.

An initial supported-Node-22 test run encountered a cached native SQLite ABI mismatch, also reproduced on an untouched public baseline. Rebuilding its native dependencies made all 68 baseline WebSocket tests pass. Final full qualification used the exact repository runtime pin and rebuilt native dependencies; no source/config bypass was added.

Boundaries

No account-authenticated production session or headed UI test was performed. Native-process acceptance uses disposable configuration/data and a deterministic local HTTP fixture. The mandatory Linux Secure Sessions PR CI remains required before merge and is not claimed passed by the local gate. Desktop release/platform packaging is not claimed qualified by this backend patch.

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.

2 participants