Repository navigation
Fix CI, correct docs, and fix high/medium review findings - #1
Merged
Merged
Conversation
The Android CI job has failed on every run since the initial release: TurnDetectorTest asserted that one second of digital silence scores below 0.5, but Smart Turn v3.2 returns 0.987 for it (identical under Python onnxruntime). The detector only runs after the VAD hears speech, so replace the assertion with a front-padding and len equivalence check. Documentation and schema corrections found in review: - protocol.md: batch example used a nonexistent `text` arg and a wrong contacts path; decision pipeline order now matches ToolDispatch and PolicyEngine; audit retention/anchors documented; column names, /health and /pair fields, accepted MCP versions, wake daily limit, dead section references fixed. - JSON schemas: add AUTOMATION and SENSITIVE_READ action classes, ten missing event topics, workflow.run audit kind, actual redaction regex, pair-response URL/TLS fields, and the detail/replay fields the runtime emits in tool results. - README offline checks match CI; directory table completed. - config.example.yaml, gateway README, development, architecture, automation, security and review docs corrected against the code. - Dead doc references removed from tool help text and code comments. - PUBLICATION_MANIFEST.json hashes refreshed for changed files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
- converse.Runtime re-initializes once when the phone reports an unknown MCP session (404 before dispatch). The inbound daemon previously failed every reply after a phone app restart while looking healthy. - inbound.py elevated mode: send_sms is refused unless the recipient appears in the owner's own message or on a new outbound allowlist (--allow-send-to / secrets/inbound-send-allowlist); tool results are marked as untrusted data. - converse.py: --local-*/--llm-api-key with a preset --brain now errors instead of being silently replaced; explicit keys go only to the custom primary, other brains use the key for their own host. - Pinned TLS clears VERIFY_X509_STRICT so Python 3.13 accepts the phone's extension-less self-signed cert; the fingerprint pin still decides. - EventChannel gap replay send failures reconnect instead of escaping. - Call outcome no longer overwritten by True; "off" reasoning sentinel mapped to None in inbound.py and dry_call.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
- tools/call failures are isError results: transport.not_sent when the request never reached the phone, transport.outcome_unknown (with correlation_id and idempotency_key) when it may have run. Clients can pass _meta.correlationId so retries reuse the phone-side idempotency key. Phone JSON-RPC errors keep their own code. The agent loop uses the same classification and tells the model not to retry blindly. - Event replay: requests carry a ref matched on reply, so an unrelated error frame no longer fails a pending replay; replay_result is checked against its subscription; failed replays retry with backoff and force a reconnect after repeated failure instead of leaving catch-up stuck. - Results the gateway cannot validate are returned as outcome-unknown errors instead of passing through as success. - Anthropic: opaque thinking parts are replayed in their original order. - Gemini: unique API-safe call ids; thoughtSignature preserved and replayed only to the same Gemini provider; illegal legacy tool ids are sanitized for Anthropic. - wait_for_event uses a fresh per-wait subscription (no stale backlog, no collision between concurrent waits); unsubscribing deletes the stored cursor; cursors reset on subscription id change or journal reset. - SQLite database and WAL/SHM files are created 0600 (DACL on Windows). - Malformed tool-call arguments return tool.invalid_arguments without calling the phone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
- Screen control can no longer operate the app itself: ui.* is refused while any of our windows is showing, launching our package and acting on our own notifications are refused (ui.self_protected). MainActivity sets FLAG_SECURE and marks token, code, switch and approval controls as sensitive data. - The admin token can be rotated from the app; rotation closes the old admin's sockets and sessions and cancels its pending approvals. - Debug ApprovalReceiver and DebugReceiver require DUMP, so only adb can drive them. - Approval prompts list the target first, then the body, then declared params, in full and with control/bidi characters escaped; undeclared args are flagged. Approve/Deny need an unlocked device and the lock screen shows a redacted version. - notifications.reply is EXTERNAL_COMMITMENT and resolves its sender for the contact deny/allow lists. - Approvals arriving within 10 s of screen control are left pending and audited instead of executing; our own notifications are hidden from notification tools. - Backup and device-to-device transfer exclude all app data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
- Session events (call.transcript, session.state, ...) are delivered only to the session's owner or the admin, on live push, replay, events.wait, workflow triggers and phone://events/recent (Principal.canSeeEvent, SessionManager.ownerOf). Unknown or ownerless sessions are admin-only. - place_call treats a slot mid-placement as busy, so two concurrent requests can no longer both dial. - Each call session is bound to its own Telecom Call (outgoing, dialed number, within 30 s of dialing). end_call, dial_dtmf, the dial watchdog, driver lease and emergency stop act only on that Call, and precise states of other calls no longer drive the session. Without an identified call, TelecomManager.endCall is used only when no other call existed at dial time and none has rung since; otherwise call.unidentified, no call touched. - The InCallService starts its microphone foreground service in release builds too (the debug-only gate was a leftover). - WAV parsing reads chunk sizes as unsigned and bounds them by the bytes present (a crafted size looped forever), requires 8..48 kHz and caps decoded audio at 300 s; play_audio validates sample_rate likewise. - /ws/sessions subscribes before reading the backlog, de-duplicates by seq, refills frames a slow socket missed from session_messages and sends a gap frame when it cannot; the frame flow drops oldest instead of stalling every socket. - Server fan-out gap NPE race, atomic subscription version, closed EventBroker statements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
The PR's Android job failed "model reproduces the reference probability" while the push run on the same commit passed. The model is QDQ int8; with ALL_OPT, ONNX Runtime runs it on fused integer kernels chosen per CPU, so some x86 runners produce a different probability than the reference. Compare against the stored reference with an unoptimized session, which executes the graph as float math on every CPU (0.00844 vs reference 0.00913 under onnxruntime). The front-end check (Kotlin features vs reference features) still uses the production ALL_OPT session on the same host. Production inference is unchanged. Assertion messages now include the values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Code review of the whole repository, followed by fixes for every high and medium finding.
mainCI has been red since the initial release because of one wrong Android test; this PR fixes it.CI fix
TurnDetectorTestasserted that digital silence scores below 0.5. Smart Turn v3.2 scores it 0.987 (identical under Python onnxruntime). The detector only runs after the VAD hears speech, so the test now checks front-padding andlenhandling instead.Docs and schemas
protocol.md: the batch example used the wrong arguments; the decision pipeline order now matches the code; audit retention is documented; field, column and version details are corrected.config.example.yaml, the gateway README and the development, architecture, automation, security and review docs.Android runtime
ui.self_protected);FLAG_SECURE; sensitive controls hidden from accessibility.DUMP.notifications.replyisEXTERNAL_COMMITMENTand resolves its sender for the contact lists.sample_rateis limited to 8000-48000.Gateway
transport.not_sent/transport.outcome_unknownresults with the idempotency key; client-supplied_meta.correlationIdfor safe retries.ref.thoughtSignatureis preserved.wait_for_eventuses a fresh per-wait subscription; cursors reset on journal or subscription change.Python drivers
send_smsrestricted to numbers the owner wrote or allowlisted; tool results marked untrusted.Behavior changes
wait_for_eventonly returns events that arrive after the wait starts.notifications.replyis hidden from peers paired with aCOMMUNICATIONceiling.Validation
assembleDebugOK.go test -race,go vetandgofmtclean.publication.py checkpasses; the manifest is regenerated.🤖 Generated with Claude Code
https://claude.ai/code/session_01CUcr2CsB79a6i7qk7hbSUP
Generated by Claude Code