Skip to content

chore(gateway): cover accepted replies with lost QA acknowledgements - #176000

Merged
vincentkoc merged 2 commits into
mainfrom
test-qa-lost-ack-receipt-ee2c
Oct 18, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
test-qa-lost-ack-receipt-ee2c

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

The existing tests do not compose a real QA message commit and lost HTTP acknowledgement with the Gateway's authoritative pending source-reply receipt.

User Impact

No production behavior changes. This regression test checks that an uncertain acknowledgement does not permit a duplicate reply for the same admitted source.

Why This Change Was Made

The test uses the real Gateway handler, capability and approval validation, ordinary SQLite source admission, and QA bus. A test-local proxy fully consumes the upstream response and verifies the committed business message before dropping the downstream acknowledgement. A distinct second call and idempotency key must preserve the original pending receipt and return delivery_ambiguous with delivered: false, without another HTTP request or message.

Related: #119057. This covers one remaining native transport composition, not the entire older PR. It complements #175535 and #175616 without replaying their separate experiments.

Evidence

  • Independent source review and formal autoreview accepted the two-file test and worker registration with no actionable findings; the subsequent static-contract correction received exact-byte independent review and a clean incremental autoreview. Formatting and whitespace checks passed. Production LOC: 0; test/registration LOC: +327.
  • The original case passed in CI run 39089306311, with generation cleanup and exit 0: PR head cad451f3c60e78d347236496411f46ae106573d3, tested merge afe4e0c1defab616e21c597946295af8dcc159f3, main parent 5588de47ba5cbec1cbd5bd997b446b8f2b27014e.
  • That run failed static gates on this test's extension type imports, noncanonical bus facade, missing invariant context arguments, catch typing and explicit cleanup throw. The correction uses public facade contracts and preserves the receipt/effect assertions and joined cleanup; no failed gate was waived.
  • Corrected head 281c993f0a8a33851d7f6adce8538cc54ee4affa passed CI run 39090070936: 34 successful jobs, 28 skipped. The exact case passed 1/1 with exit 0 and generation cleanup on merge 9ab64aa61afc4fdc9c3cb97da8abbcbd4ae7265a, main parent 90e30d0c40d85e6c09479759d72fb4e893a8f33a. Production/test types, lint and boundary gates passed. Build was skipped, not claimed. Determining Gateway/receipt/QA owners are unchanged between the frozen source and this tested main parent.
  • The local source checkout is code-only; no test pass is claimed from tooling qualification. Exact-head review and native landing gates remain separate from this proof.
  • Scope: direct Gateway handler/API invocation, real Node HTTP, QA business-message storage and SQLite receipts. This does not prove a live Gateway connection, default-local tool routing, real external channel behavior, refresh/restart recovery or performance.

@vincentkoc vincentkoc self-assigned this Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Oct 18, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 18, 2026 02:13
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review the current head 281c993f0a8a33851d7f6adce8538cc54ee4affa. The original case passed; this correction addresses its public-facade, type-boundary and cleanup-lint issues. The corrected native HTTP/SQLite case also passes in CI run 39090070936; remaining required checks are still authoritative.

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds a Gateway integration test that prevents duplicate source replies after QA accepts a message but loses its HTTP acknowledgement.

Example: QA accepts “One accepted source reply” for qa-source-turn, then the proxy drops its response.

  • Before: Existing tests did not compose this HTTP failure with the Gateway’s real SQLite source-reply receipt.
  • After: The new test verifies that qa-call-second returns delivery_ambiguous while preserving the first pending receipt and exactly one business message.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused coverage with no actionable defect; evidence is scoped to an in-process production composition rather than a shipped Gateway entry point.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored coverage-only PR adds no production behavior; its in-process composition uses the real Gateway handler, SQLite receipt owner, QA HTTP client, and bus, with a successful exact-head CI shard.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: A future receipt or transport regression could duplicate a reply after QA accepts it but its acknowledgement is lost.
Reason: The maintainer-authored change protects a distinct real-transport composition that existing mocked receipt tests and separate refresh or handoff tests do not cover.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR adds useful, distinct transport-and-receipt coverage; the pinned diff has no actionable findings and its exact-head CI gates passed.

Priority: P3
Reviewed head: 281c993f0a8a33851d7f6adce8538cc54ee4affa

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No failing production baseline or shipped Gateway connection is claimed; this test adds coverage for existing behavior through direct handler invocation.
Agent review details

How this fits together

The Gateway message.action handler validates an admitted agent request, records its source-reply intent through the session actor, and dispatches through the QA plugin’s native HTTP client; uncertain delivery leaves the receipt pending and suppresses another same-source send.

flowchart TD
  A[Admitted agent request] --> B[Gateway message action]
  B --> C[SQLite source reply receipt]
  B --> D[QA channel HTTP client]
  D --> E[Test response proxy]
  E --> F[QA bus business message]
  E --> G[Lost acknowledgement]
  C --> H[Distinct retry suppressed]
Loading

Technical review

Best possible solution:

Retain this focused composition in the existing Gateway database-worker test lane.

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

This is coverage for an existing contract, rather than a reported current production failure; inspection confirms the intended fault and assertions, and GitHub confirms the linked shard succeeded.

Is this the best way to solve the issue?

The smallest complete change is one integration case plus existing worker-lane registration: preserve ambiguity after accepted delivery and reject a distinct same-source send through the owners already present.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 51cf7e45b2bc.

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduction: The merge-base-to-head diff adds only the integration test and its database-worker registration; it changes no production implementation. (src/gateway/server-methods/send.qa-reply-ambiguity.integration.test.ts:1, 281c993f0a8a)
  • Business acceptance precedes injected failure: The proxy consumes the complete upstream response and checks the actual bus message before destroying the downstream response. (src/gateway/server-methods/send.qa-reply-ambiguity.integration.test.ts:91, 281c993f0a8a)
  • Distinct retry tests the authoritative receipt: Fresh tool-call and idempotency identities bypass request-cache replay; assertions retain the original terminal-pending receipt, return delivery_ambiguous, and require one HTTP request and one stored message. (src/gateway/server-methods/send.qa-reply-ambiguity.integration.test.ts:282, 281c993f0a8a)
  • Current-main behavior: The determining Gateway, receipt, QA transport, and bus modules match fetched main; existing source maps unresolved terminal receipts to delivery_ambiguous before another transport dispatch. (src/infra/outbound/source-reply-mirror.ts:185, 51cf7e45b2bc)
  • Exact-head CI: CI run 39090070936 identifies the reviewed head and completed successfully, including the linked integration shard, types, lint, boundaries, and CI gate; head status contexts also report success. Build was skipped. (281c993f0a8a)
  • Inspection limits: Raw job-log retrieval was blocked at GitHub’s redirected artifact host, so case-level output and generation cleanup were not independently verified. Some historical blobs were unavailable locally; REST commit patches supplied the relevant introduction evidence. Neither limitation establishes a patch defect. (281c993f0a8a)

PR surface

Tests +327. Total +327 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 327 0 +327
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 327 0 +327

Review metrics

Metric Value Why it matters
Production versus test LOC Production +0; test and registration +327 The growth supplies real admission, SQLite receipts, HTTP fault injection, observable message assertions, and joined cleanup without adding production hooks.

Labels

Label changes:

  • add P3: This is focused coverage for existing behavior with no production behavior change or demonstrated urgent regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is focused coverage for existing behavior with no production behavior change or demonstrated urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 17, 2026, 10:40 PM ET / October 18, 2026, 02:40 UTC.

@vincentkoc
vincentkoc merged commit 9b70707 into main Oct 18, 2026
143 checks passed
@vincentkoc
vincentkoc deleted the test-qa-lost-ack-receipt-ee2c branch October 18, 2026 02:47
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…penclaw#176000)

* chore(gateway): cover accepted replies with lost QA acknowledgements

* test(gateway): respect QA facade and fixture static contracts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant