Skip to content

fix(a2a): a delivery reads its sent event from its own ledger - #423

Merged
Jacksondr5 merged 1 commit into
j5/mainfrom
fix/delivery-own-ledger
Oct 3, 2026
Merged

Jacksondr5 merged 1 commit into
j5/mainfrom
fix/delivery-own-ledger

Conversation

@Jacksondr5

Copy link
Copy Markdown
Owner

Problem

Delivery to a local agent re-read its message's message.sent event by seq alone. seq is numbered per ledger (the key is (squadron_id, seq)), so on a server with more than one Squadron the lookup could match another Squadron's event and deliver the other message's attachments, or silently drop its own.

Fixes #421

What changed

  • DeliveryWorker scopes the lookup to the delivery's own ledger: WHERE squadron_id = ${row.squadron_id} AND seq = ${row.sent_seq}, the table's primary key. The two other sent_seq reads in the same file were already scoped.
  • A focused test builds two ledgers whose message.sent events share a seq and carry different attachments, drains the worker, and asserts each delivery gets its own. It fails on the old query (expected [ 'attachment-one' ] to deeply equal [ 'attachment-two' ]) and passes with the fix.

I checked the other seq reads of j5_a2a_comm_event and j5_a2a_placement_event under apps/server/src/j5. All of them are already scoped by squadron_id.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above, and a video for motion or interaction — n/a, server-only
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR — n/a, J5-owned files only
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md — n/a
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (see AGENTS.md) — server-side query fix; no contract, client, or provider change
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them — no doc change needed

Claude Opus 5.5 (1M context), Claude Code harness in J5 Code.

🤖 Generated with Claude Code

Delivery to a local agent re-read its message.sent event by seq alone.
seq is numbered per ledger, so with more than one Squadron it could read
another Squadron's event and attach the wrong references, or drop them.
Scope the lookup to the delivery's squadron_id.

Fixes #421

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 3, 2026 1:57am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 36 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 50 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 023c6429-2241-46ad-9665-6c80f6ea7938
📥 Commits

Reviewing files that changed from the base of the PR and between e1621b5 and 1adf8fa.

📒 Files selected for processing (2)
  • apps/server/src/j5/a2a/DeliveryWorker.test.ts
  • apps/server/src/j5/a2a/DeliveryWorker.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:XS 0-9 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list. labels Oct 3, 2026
@Jacksondr5
Jacksondr5 merged commit 7ae83f1 into j5/main Oct 3, 2026
28 checks passed
@Jacksondr5
Jacksondr5 deleted the fix/delivery-own-ledger branch October 3, 2026 02:16

This branch was successfully deployed

1 active deployment
Preview — 1adf8fa6 Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delivery can attach another Squadron's message references

1 participant