fix(stt): rewrite stale-sidecar voice error + e2e registration guard#1298
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR guards the transcribeCloud JSON-RPC call, rewriting "unknown method" errors into a user-facing restart message while rethrowing other errors; it adds unit tests for both error paths and an E2E test that verifies the RPC method is present and dispatches without producing an "unknown method" error. ChangesVoice Transcription Error Handling
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
senamakel
left a comment
There was a problem hiding this comment.
there's a merge conflict bro... pls fix it
Pin the registration two ways so issue tinyhumansai#1289's "unknown method: openhuman.voice_cloud_transcribe" can't recur from a controller-registry refactor: 1. /schema dump must list the method (frontend discovery). 2. RPC dispatch on the method must NOT hit the unknown-method branch — it may still fail downstream on validation/upstream STT, but the handler must be reachable. Refs tinyhumansai#1289.
When an end user runs a frontend newer than the bundled core sidecar (e.g. dev build, or auto-update lag), `openhuman.voice_cloud_transcribe` returns a raw "unknown method" error that's opaque to the user. Catch it in the cloud-STT client and surface a concrete next-step: "Restart the OpenHuman desktop app to pick up the latest core sidecar." Closes tinyhumansai#1289.
e4615b6 to
3769398
Compare
|
Rebased on latest |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/src/features/human/voice/sttClient.ts (1)
66-79: ⚡ Quick winAdd debug logs for both catch branches in
transcribeCloud.The rewritten and passthrough error paths currently drop observability; add
sttLog(...)before rethrowing so field debugging can distinguish stale-sidecar rewrites from other RPC failures.Proposed patch
} catch (err) { @@ const msg = err instanceof Error ? err.message : String(err); if (msg.includes('unknown method')) { + sttLog('transcribe rpc stale-sidecar path hit; rewriting unknown-method error'); throw new Error( 'Voice transcription is unavailable in this build. Restart the OpenHuman desktop app to pick up the latest core sidecar.' ); } + sttLog('transcribe rpc failed (passthrough): %O', err); throw err; }As per coding guidelines: “Add substantial, development-oriented logs at … error handling paths; use namespaced
debuglogs in production app code.”🤖 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 `@app/src/features/human/voice/sttClient.ts` around lines 66 - 79, In transcribeCloud's catch block (in sttClient.ts) add development-oriented namespaced logging via sttLog before rethrowing: log a clear message and error details in the 'unknown method' branch (when msg.includes('unknown method')) and also log the passthrough/rewritten error path just before throwing err so callers can distinguish stale-sidecar errors from other RPC failures; reference the transcribeCloud function and use sttLog(...) with the error object or msg to preserve observability.
🤖 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.
Inline comments:
In `@tests/json_rpc_e2e.rs`:
- Around line 3839-3847: The test currently only checks error.message for the
"unknown method" text which can miss cases where the server puts that text
elsewhere; update the guard to stringify or inspect the entire error object (the
Value at resp.get("error")) and check that the combined error representation
contains "unknown method" (use the existing resp and err_msg variables as
anchors) so the assertion fails if any part of the error object indicates an
unknown-method response.
---
Nitpick comments:
In `@app/src/features/human/voice/sttClient.ts`:
- Around line 66-79: In transcribeCloud's catch block (in sttClient.ts) add
development-oriented namespaced logging via sttLog before rethrowing: log a
clear message and error details in the 'unknown method' branch (when
msg.includes('unknown method')) and also log the passthrough/rewritten error
path just before throwing err so callers can distinguish stale-sidecar errors
from other RPC failures; reference the transcribeCloud function and use
sttLog(...) with the error object or msg to preserve observability.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e34b7aee-a9d8-4c8d-bf1e-9f4e2b02cc35
📒 Files selected for processing (3)
app/src/features/human/voice/sttClient.test.tsapp/src/features/human/voice/sttClient.tstests/json_rpc_e2e.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- app/src/features/human/voice/sttClient.test.ts
CodeRabbit review on PR tinyhumansai#1298: - Add `sttLog` calls in both `transcribeCloud` catch arms so field debugging can distinguish stale-sidecar rewrites from other RPC failures. Per the project's debug-logging policy, error paths get namespaced `debug` logs in production app code. - Harden the regression guard in `voice_cloud_transcribe_registered_e2e` to inspect the full `error` object (lowercased) instead of only `error.message`. A future server-shape change that moved the dispatcher's unknown-method string into `error.data` would otherwise silently pass. Refs tinyhumansai#1289.
Summary
unknown method: openhuman.voice_cloud_transcribebecause end users were running a frontend newer than the bundled core sidecar.Problem
The mascot's mic-only composer calls
openhuman.voice_cloud_transcribeviaapp/src/features/human/voice/sttClient.ts. The method is registered correctly insrc/openhuman/voice/schemas.rs(added in #1253), wired into the controller registry insrc/core/all.rs, and reachable through the dispatcher. So in HEAD the bug is not a missing registration — it's a user-experience gap when the running core sidecar is older than the frontend (auto-update lag, dev build, or staged-binary mismatch). Users got a raw "unknown method: openhuman.voice_cloud_transcribe" with no remediation hint.There is also no regression coverage that would have caught a future refactor accidentally dropping
voice_cloud_transcribefrom the registry — every other voice method is in the same boat.Solution
Two atomic commits:
test(voice): JSON-RPC e2e regression for voice_cloud_transcribe— pin the registration two ways:GET /schemamust listopenhuman.voice_cloud_transcribe.Err("unknown method: …")). The call may still fail downstream — that's fine — but the handler must be reachable.fix(stt): rewrite "unknown method" error with actionable restart hint—transcribeCloudnow catchesunknown methoderrors fromcallCoreRpcand rethrows with a user-facing hint pointing at the desktop app restart, instead of bubbling the raw transport-layer message.Frontend tests cover both paths (rewrite + verbatim passthrough for unrelated errors). Backend test exercises the full RPC wire path.
Submission Checklist
docs/TESTING-STRATEGY.mddiff-cover) meet the gate enforced by.github/workflows/coverage.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge.docs/TEST-COVERAGE-MATRIX.mdreflect this change## Relateddocs/TESTING-STRATEGY.md)docs/RELEASE-MANUAL-SMOKE.md)Closes #NNNin the## RelatedsectionImpact
Related
Summary by CodeRabbit