Repository navigation
fix(pusher): bound delivery and runtime failure handling - #10678
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the careful pusher hardening work here. The direction looks valuable: bounding the runtime buffers, reducing container/Kubernetes privilege, pinning the LC3 source, preserving pending deliveries across transient send failures, and adding focused regression coverage all fit the reliability/security goals for this surface.
I don't think this is ready to mark review-complete yet, mainly because this PR changes the listen/pusher protocol/runtime boundaries and the current shape conflicts with the repo's backend ownership rules:
-
backend/routers/pusher.pynow importsrouters.pusher_finalizationandrouters.pusher_protocol.backend/AGENTS.mddefines the backend import hierarchy asdatabase -> utils -> routers -> main.pyand explicitly warns that cross-importing between routers will break. These extracted helpers are not route handlers, so they should live under an appropriateutils//service module (or another non-router helper package) before this lands. -
This changes the listen/pusher WebSocket protocol behavior and finalization semantics (frame validation, opcode handling, durable finalization handoff, buffering/retry behavior), but
docs/doc/developer/backend/listen_pusher_pipeline.mdxwas not updated. The backend guide specifically requires that doc to move with changes to the listen/pusher WebSocket protocol.
The CI/check coverage is encouraging, and I did not see a security/supply-chain attack pattern in the diff. Because the PR is still draft and touches workflow/deployment-sensitive pusher runtime paths, I’m leaving this as changes requested rather than approval; a maintainer should still review the deployment/runtime implications after the module boundary and docs are fixed.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Addressed both review blockers in |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up here. I re-reviewed the current head and the two blockers from my previous review look resolved: the protocol/finalization helpers now live under backend/utils/, and docs/doc/developer/backend/listen_pusher_pipeline.mdx now documents the validated frame handling, bounded buffering/replay behavior, and durable finalization handoff.
I’m leaving this as a positive maintainer signal rather than a formal approval because the PR is still a large backend runtime/deployment change touching the pusher WebSocket protocol, durable finalization ownership, container privilege, Kubernetes credential mounting, and deploy-trigger paths. Those are the right areas to have a human maintainer look over before merge even though the automated checks are now green.
I did not see a serious security/supply-chain attack pattern in the current diff. The security hardening direction is good: pinned LC3 source, non-root pusher container, disabled service-account token automount, explicit frame validation, and bounded per-session buffering are all improvements. Main thing left is human review of the rollout/runtime implications before landing.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Current head moved protocol/finalization helpers under backend/utils and updated the listen/pusher pipeline documentation, resolving the two blockers from this automation review.
Retain transcript and audio buffers until WebSocket sends succeed, release cancelled half-open probes, and isolate transcript sinks so one integration cannot suppress another. Verification: focused Pusher tests (51 passed); backend typecheck (0 errors); Pusher rollout gate passed. Failure-Class: none
Build liblc3 from an exact reviewed commit and remove the unused Helm test that probed a nonexistent root route with a mutable image. Verification: source-closure tests passed; Pusher rollout and source-closure gates passed.
Restore cancelled sends, bound shutdown retries, validate wire inputs, expose queue drops, and dispatch transcript sinks independently. Delete the mirrored private-cloud test suite in favor of production-handler coverage. Verification: 128 focused tests passed; backend typecheck reported 0 errors. Failure-Class: none
Use a Dockerfile environment constant instead of an overridable build argument and enforce that contract in the source-closure test. Verification: source-closure tests and runtime-image contract passed.
Disable Kubernetes service-account token automount in both environments and verify the rendered pod contract. Verification: rendered contracts, rollout gates, and config-reference preflights passed. Failure-Class: none
Verification: python3 backend/scripts/validate_rendered_deployment_contract.py; python3 backend/scripts/verify_pusher_config_references.py --environment dev --namespace dev-omi-backend --render-only; python3 backend/scripts/verify_pusher_config_references.py --environment prod --namespace prod-omi-backend --render-only; python3 -m pytest -q --noconftest backend/tests/unit/test_pusher_auto_deploy_paths.py backend/tests/unit/test_verify_pusher_source_closure.py backend/tests/unit/test_rendered_deployment_contract.py backend/tests/unit/test_verify_pusher_config_references.py (43 passed) Failure-Class: none
Verification: python3 backend/scripts/validate_rendered_deployment_contract.py; python3 backend/scripts/verify_pusher_rollout_gate.py preflight; python3 backend/scripts/verify_pusher_rollout_budget.py; python3 backend/scripts/verify_pusher_source_closure.py; python3 -m pytest -q --noconftest backend/tests/unit/test_pusher_auto_deploy_paths.py backend/tests/unit/test_verify_pusher_source_closure.py backend/tests/unit/test_rendered_deployment_contract.py backend/tests/unit/test_verify_pusher_config_references.py (43 passed) Failure-Class: none
Bound variable-size buffered audio and private-cloud pending work, preserve terminal upload failure telemetry, and reject malformed opcode payloads. Verification: 65 focused Pusher tests passed; backend typecheck passed; Black and git diff --check passed. Failure-Class: new
Serialize buffer flush ownership, keep stale connection success from bypassing breaker cooldown, validate and encode the Pusher URL, and retain failed speaker-sample replay. Verification: 55 focused tests passed; backend typecheck completed with 0 errors. Failure-Class: none
Verification: 98 focused Pusher/finalization tests passed; backend typecheck passed; Black and diff checks passed.
Verification: authoritative backend test.sh runner passed test_async_http_infrastructure.py (48 tests).
Move Pusher protocol and finalization helpers into utils and document the validated wire and durable ownership contracts. Verification: 146 focused tests passed; production Pyright passed; Black and diff checks passed.
91ad6d2 to
6e14885
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Review: Bounded Delivery & Failure Handling
✅ APPROVE
Well-structured pusher refactor with sound safety properties:
Queue Bounding — Correct
- ByteBudget (20MB/session) tracks all in-flight audio correctly
- Item-count limits + byte budget work in tandem
- Dropped items properly release budget
Error Handling — Solid
- Categorized failure modes (timeout, HTTP status, network vs logic)
- Durable Firestore finalization for delivered-but-unacked items
- Graceful degradation when backend is unavailable
Minor Observations (non-blocking)
- Container UID change and removed service-account token — confirm rollout implications before deploy
- Consider adding a max-retry cap to the reconnection loop
LGTM — safe to merge once CI fully completes.
Summary
utils/without router cross-imports or compatibility aliases.dockerignorechangesRoot cause
The legacy Pusher path had independent queue, reconnect, shutdown, image, and deployment-config owners without one enforced failure boundary. Buffers were cleared before sends completed, item-count limits did not bound variable-size audio memory, malformed frames reached application paths, and deployment defaults retained stale privilege and credential assumptions.
Impact
Transient failures no longer silently discard buffered work, malformed clients fail with protocol close codes, one connection cannot retain unbounded queued audio, and the runtime has a smaller credential and container privilege surface. The router is reduced from 1,056 to 753 lines, with protocol and finalization behavior isolated behind existing production seams.
Validation
python3 backend/scripts/validate_rendered_deployment_contract.pymake preflight: 26 checks passedFailure-Class: none
Related: #6060, #6752, #6800, #9237, #9786