Skip to content

test(bots): wait for attachment listing replies - #477

Merged
nixuuu merged 1 commit into
devfrom
test/bot-forwarding-race
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
test/bot-forwarding-race

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026

Copy link
Copy Markdown
Member

The forwarding integration test can see FIXTURE_OK as the last message after list_attachments: finishing the forwarded worker turn schedules a separate bot follow-up, whose reply can follow the listing response. CI run 42784104536 attempt 1 failed on that assumption.

Wait for the bot-authored TOOL_RESULT containing this attachment ID, using the existing bounded eventually helper. Keep the assertion after the wait so a missing result still fails. The immediate forwarding-notice assertion and the blob, worker-path and attribution checks remain intact.

This is a test race:

  • Conversation reads already order messages by the unique bot_messages.seq; equal timestamps do not make the returned order unstable.
  • forwardedNotice runs inside the fenced botAction transaction, before the forwarding tool completes. botQueue.finish inserts the answer and settles its turn in one transaction.
  • botDeliveries.deliver schedules a distinct bot turn when the worker turn finishes. The scripted CLI replies FIXTURE_OK to that notification. settled() can correctly return an idle conversation with that follow-up as its last message.

Validation:

  1. Before: 30 sequential runs of TMPDIR=/var/tmp bun run check:tmp tests/integration/bot-files.test.ts; 29 passed, run 8 reproduced the exact CI failure (Received: "FIXTURE_OK").
  2. After: the same 30 sequential runs all passed (270 test cases). Every run reported check:tmp: nothing left in the temp dir.
  3. bun install, bun run typecheck, bun run lint, bun run format:check, and git diff --check pass.

Only the requested integration file and allowed static checks were run locally; the full suite remains for CI. No product, protocol, schema or UI behavior changes.

Related: #469

The forwarded worker turn can finish after list_attachments and queue a
separate bot follow-up. Its FIXTURE_OK reply may be the last message even
though the listing already completed. Wait for the bot's tool response
containing the attachment ID instead of assuming it is last.

Related: #469
@nixuuu
nixuuu merged commit 56f4265 into dev Nov 10, 2026
9 checks passed
@nixuuu
nixuuu deleted the test/bot-forwarding-race branch November 10, 2026 09:18
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