Skip to content

test(qqbot): delivery trace goldens for replace-mode streaming and reply budget - #104582

Merged
steipete merged 1 commit into
mainfrom
claude/chanref-p0-traces-qqbot
Jul 11, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/chanref-p0-traces-qqbot

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #104318

What Problem This Solves

Extends the delivery trace harness (#104478) to qqbot — the budget-constrained REPLACE-mode streaming channel. QQ enforces ≤5 replies per inbound msg_id server-side, and typing renewals spend the same budget, making this the reference case for v2's budget/credential sequencing.

Why This Change Was Made

Five golden scenarios drive the real engine wiring (StreamingController, gateway typing on the core keepalive loop post-#104438, outbound dispatch, budget-limited sends) with mocked QQ API: REPLACE-mode stream lifecycle; budget exhaustion (initial notify + exactly 3 renewals then reserve silence; passive→proactive flip at the limiter); final-only; cancel; media interrupt (session close → media send → fresh stream session). Budget spends are first-class golden events. Warts pinned as oracles — most notably that the gateway static-final path sends without consulting the reply limiter at all (9 passive spends against the 5 cap; flagged separately as a likely production bug), typing budget and ReplyLimiter double-booking the same server budget, and cancelled runs still sealing the stream with a DONE re-send.

User Impact

None at runtime — test infrastructure; two real defect candidates surfaced and tracked separately.

Evidence

  • Testbox tbx_01kx91xb5n4z4kkqmzs7c27qs9: full qqbot suite + pnpm check:changed green (one earlier lease died mid-hydration, infra); trace-only re-verify tbx_01kx928q7zknkmp9gvmxmawbak 5/5 — Linux verify-mode golden stability.
  • Autoreview (codex gpt-5.6-sol, xhigh): clean (first run correctly rejected secret-shaped fixture strings; placeholders substituted — no credential-like values in goldens).

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 1:45 PM ET / 17:45 UTC.

Summary
Adds QQBot delivery-trace tests and JSONL goldens for replace-mode streaming, reply-budget exhaustion, final-only delivery, cancellation, and media interruption.

PR surface: Source +55, Tests +457. Total +512 across 6 files.

Reproducibility: not applicable. as a user-facing bug; the patch defect is reproducible from source by following tool-progress in the test and comparing it with the current gateway info.kind === "tool" branch.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: persistent cache schema: extensions/qqbot/src/__traces__/media-interrupt.trace.jsonl. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #104318
Summary: This PR is a candidate Phase 0 behavior-lock increment for the channel-adapter program, with the merged harness and typing-loop PRs as prerequisites rather than duplicates.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Correct the event-to-production-path mapping and regenerate the budget golden.
  • Rerun the focused QQBot trace verification and changed checks on the corrected head.

Risk before merge

  • [P1] Merging the current golden would encode a passive-to-proactive ReplyLimiter transition under an event name whose real gateway path does not perform that transition, reducing confidence in later channel-engine refactors.

Maintainer options:

  1. Decide the mitigation before merge
    Add a distinct direct message-tool/channel-send trace event that intentionally exercises outbound.sendText, or change the existing tool-progress steps to drive the actual gateway tool-delivery branch, then regenerate the budget golden.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The remaining blocker is a narrow mechanical test repair: separate direct message-tool sends from tool-progress, update the scenario, and regenerate the affected golden; protected maintainer handling still governs merge.

Security
Cleared: The test and JSONL fixture-only diff adds no dependency, workflow, permission, package-resolution, lifecycle-hook, secret-handling, or production code-execution surface.

Review findings

  • [P2] Model direct message-tool sends as a distinct trace event — extensions/qqbot/src/delivery-trace.test.ts:350-352
Review details

Best possible solution:

Add a distinct direct message-tool/channel-send trace event that intentionally exercises outbound.sendText, or change the existing tool-progress steps to drive the actual gateway tool-delivery branch, then regenerate the budget golden.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a user-facing bug; the patch defect is reproducible from source by following tool-progress in the test and comparing it with the current gateway info.kind === "tool" branch.

Is this the best way to solve the issue?

No, not in its current form: extending the shared trace harness is the right strategy, but overloading tool-progress to mean a direct channel send creates a competing, inaccurate event model.

Full review comments:

  • [P2] Model direct message-tool sends as a distinct trace event — extensions/qqbot/src/delivery-trace.test.ts:350-352
    tool-progress still calls sendChannelOutboundText, but current gateway tool deliveries either use sendTextOnlyReply for immediate progress or buffer the payload. The budget golden therefore attributes ReplyLimiter fallback to the wrong production event. Use a distinct direct-channel-send step, or drive the real info.kind === "tool" branch, then regenerate the golden. This is the previously reported blocker and remains unresolved on the force-pushed head.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 49ff54e63af5.

Label changes

Label justifications:

  • P2: The inaccurate test oracle has bounded maintainer impact on QQBot refactor safety and does not alter production runtime behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-labeled test-infrastructure PR has focused Testbox trace and changed-check evidence; the external contributor real-setup proof gate is not applicable.
Evidence reviewed

PR surface:

Source +55, Tests +457. Total +512 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 5 55 0 +55
Tests 1 457 0 +457
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 512 0 +512

Acceptance criteria:

  • [P1] Run the focused extensions/qqbot/src/delivery-trace.test.ts test in verify mode through Testbox/Crabbox.
  • [P1] Run the full QQBot extension test lane through Testbox/Crabbox.
  • [P1] Run pnpm check:changed through the repository-approved remote validation path.

What I checked:

Likely related people:

  • steipete: Authored the merged shared delivery-trace harness and QQBot typing keepalive adoption that define the intended test composition. (role: introduced trace behavior and recent QQBot refactor; confidence: high; commits: ba826be268a7, 3f33f0bb5f3e; files: src/channels/plugins/contracts/trace/delivery-trace.ts, extensions/qqbot/src/engine/gateway/typing-keepalive.ts)
  • vincentkoc: Recent current-main history touches the central QQBot gateway and outbound test surface used to compare this trace against production behavior. (role: recent QQBot area contributor; confidence: medium; commits: e8c83ac0b4fd; files: extensions/qqbot/src/engine/gateway/outbound-dispatch.ts, extensions/qqbot/src/engine/messaging/outbound.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-11T17:29:00.952Z sha d70f5b81806351b80f396e5390f9c420eccdb865 :: needs real behavior proof before merge. :: [P2] Use the real tool-progress delivery path

@steipete
steipete force-pushed the claude/chanref-p0-traces-qqbot branch from d70f5b8 to a51704c Compare July 11, 2026 17:39
@steipete steipete self-assigned this Jul 11, 2026
@steipete
steipete merged commit 554f253 into main Jul 11, 2026
95 checks passed
@steipete
steipete deleted the claude/chanref-p0-traces-qqbot branch July 11, 2026 17:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: qqbot maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant