fix(daemon): surface the relay's rejection reason on a failed send - #261
Conversation
A failed reply logged only `send to <peer> failed: HTTP 400: /messages`,
hiding *why* the relay rejected it (e.g. "body must be encrypted ciphertext",
"prekey envelope requires ephemeralKey and signedPreKeyId"). TinyPlaceError
already carries the parsed `{ error }` body — fold it into the log line so the
failure is diagnosable without adding request logging.
Co-Authored-By: Claude <noreply@anthropic.com>
|
@sanil-23 is attempting to deploy a commit to the Vezures Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthrough
ChangesDaemon error logging
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sdk/typescript/src/cli/daemon/runtime.ts (1)
468-474: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a camelCase local for the response body.
body_at Line 468 violates the repository rule requiring camelCase variable names. Rename it tobodyValueorresponseBody.Proposed rename
- const body_ = (error as { body?: unknown }).body; + const bodyValue = (error as { body?: unknown }).body; - return body_ && - typeof body_ === "object" && - "error" in body_ && - (body_ as { error?: unknown }).error !== undefined - ? String((body_ as { error: unknown }).error) + return bodyValue && + typeof bodyValue === "object" && + "error" in bodyValue && + (bodyValue as { error?: unknown }).error !== undefined + ? String((bodyValue as { error: unknown }).error)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sdk/typescript/src/cli/daemon/runtime.ts` around lines 468 - 474, In the error-response formatting logic, rename the local variable body_ to a camelCase name such as bodyValue or responseBody, and update all references within that expression consistently.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@sdk/typescript/src/cli/daemon/runtime.ts`:
- Around line 468-474: In the error-response formatting logic, rename the local
variable body_ to a camelCase name such as bodyValue or responseBody, and update
all references within that expression consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8efb705c-2505-4514-8fe1-20c0f08e2c4d
📒 Files selected for processing (2)
sdk/typescript/src/cli/daemon/runtime.tssdk/typescript/tests/daemon.test.ts
Problem
When a daemon reply is rejected by the relay, the log showed only:
That hides why it was rejected. The relay returns a specific reason in the body —
body must be encrypted ciphertext,prekey envelope requires ephemeralKey and signedPreKeyId,ratchet metadata requires ratchetKey and messageNumber, etc. — each pointing at a different, actionable cause. Without it, a400is undiagnosable from the daemon log alone.Fix
TinyPlaceErroralready carries the parsed{ error }response body. Fold that reason into thesendRawfailure log so the line becomes:Log-only change — no protocol or transport behavior is touched, and it deliberately edits the daemon runtime rather than
TinyPlaceError.message(which the CLI asserts on exactly).Validation
pnpm --filter @tinyhumansai/tinyplace build✅pnpm --filter @tinyhumansai/tinyplace test— 579 passed (adds a case asserting the reason is folded into the send-failure log) ✅🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests