Skip to content

fix(a2a): say why a peer was unreachable, not just that it was - #288

Merged
Jacksondr5 merged 1 commit into
j5/mainfrom
j5/peer-unreachable-reason
Sep 30, 2026
Merged

Jacksondr5 merged 1 commit into
j5/mainfrom
j5/peer-unreachable-reason

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Based on j5/main. It was split out of the cross-server peering stack (#172–#198, now merged) and edits PeerRegistryService.ts, which #173 introduced.

Problem

When j5 a2a peer add or the Connections dialog cannot reach the other server, the PeerUnreachableError reason carried only the outermost message. With Effect's HTTP client that is a generic "Transport error (GET …/hello)"; the part an operator needs, ECONNREFUSED, a DNS miss, a TLS failure, sits on the error's cause chain and was dropped.

Fix

reasonOf in PeerRegistryService.ts walks the cause chain up to four levels and joins the distinct messages. Both callers use it: the unreachable error and the "hello answered with an unexpected shape" error. Nothing else changes; the registry tests assert on the leading text and still pass.

Split out of #198 at review request (bryantderosier), since it has nothing to do with carrying names.

Built by Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Error messages now include relevant details from underlying causes, making failures easier to understand. Empty and repeated messages are omitted, and cause details are included up to three levels deep.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 effective changed lines (test files excluded in mixed PRs). labels Sep 24, 2026
@Jacksondr5
Jacksondr5 force-pushed the j5/peer-unreachable-reason branch from 844ba9d to 79c94ae Compare September 30, 2026 04:18
@Jacksondr5
Jacksondr5 force-pushed the j5/peering-1-registry branch from 2593545 to 6ccc139 Compare September 30, 2026 04:18
@vercel

vercel Bot commented Sep 30, 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 Sep 30, 2026 3:03pm UTC

Request Review

The unreachable reason carried only the outer message, so an operator saw
"Transport error (GET …/hello)" and nothing about the socket or header
failure beneath it. Walk the cause chain and join the distinct messages.

Built by Claude Fable 5.1 in Claude Code.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Jacksondr5
Jacksondr5 force-pushed the j5/peer-unreachable-reason branch from 44e17d4 to 6eeec53 Compare September 30, 2026 15:02
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 82d5a9e3-621c-441a-8b5a-79219f17d41f

📥 Commits

Reviewing files that changed from the base of the PR and between 0d2b37d and 6eeec53.

📒 Files selected for processing (1)
  • apps/server/src/j5/a2a/PeerRegistryService.ts

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


📝 Walkthrough

Walkthrough

reasonOf now extracts distinct, nonempty messages from an error and up to three causes, then joins them with : .

Changes

Error reason formatting

Layer / File(s) Summary
Collect cause-chain messages
apps/server/src/j5/a2a/PeerRegistryService.ts
reasonOf follows up to three causes, skips empty and duplicate messages, and joins the remaining messages with : .

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6eeec

This change gives administrators and operators more detail when a peer cannot be reached. The inspected request and response paths show no concrete harmful exposure or behavior regression, so no material issue remains before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: exposing the reason a peer was unreachable.
Description check ✅ Passed The description explains the problem, the fix, affected callers, scope, testing status, and implementation provenance. It uses a "Fix" heading instead of the template's "What changed" heading and omit…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

@Jacksondr5
Jacksondr5 merged commit 00c41f2 into j5/main Sep 30, 2026
38 checks passed
@Jacksondr5
Jacksondr5 deleted the j5/peer-unreachable-reason branch September 30, 2026 15:13
bryantderosier added a commit that referenced this pull request Sep 30, 2026
BastiHu squashed #314 into 2ab2cfc on top of j5/main. Its content equals
e2f4f4f, which this branch already merged, plus #288 from j5/main, so
overlapping hunks keep this branch's side.

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

This branch was successfully deployed

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

Labels

size:S 10-29 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.

1 participant