Skip to content

fix: double final-chunk race — demuxer sends tail as intermediate, handler owns final (#116) - #120

Closed
blaspat wants to merge 11 commits into
mainfrom
feat/issue-116-exec-chunk
Closed

fix: double final-chunk race — demuxer sends tail as intermediate, handler owns final (#116)#120
blaspat wants to merge 11 commits into
mainfrom
feat/issue-116-exec-chunk

Conversation

@blaspat

@blaspat blaspat commented Aug 11, 2026

Copy link
Copy Markdown
Owner

What

The demuxer's finish() was sending the tail output as more=false (final chunk), then the handler was also sending a more=false chunk with metadata. This caused a double-finalization race on the server — the first more=false resolved the waiter, and the second hit a stale state.

Fix

Demuxer now sends tail as more=true (intermediate chunk). Only the handler sends the real more=false final chunk with exit_code, status, duration_ms, and truncated metadata. Single source of truth for completion.

Tested

  • go build ./... — clean
  • go test ./... -count=1 — all pass (except pre-existing flaky TestReconnect_RecoversAfterServerRestart)

blaspat added 11 commits August 11, 2026 07:52
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
#116)

Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
…#116)

Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
…ns final (#116)

Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
@blaspat

blaspat commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #121 — clean branch from main with no conflicts.

@blaspat blaspat closed this Aug 11, 2026
@blaspat
blaspat deleted the feat/issue-116-exec-chunk branch August 11, 2026 09:30
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