Repository navigation
feat(gateway): live-switch src/remote-gateway-bridge.py to the canonical ag2-sparrow client - #2083
Conversation
…cal ag2-sparrow client (#2082 Task#3) src/remote-gateway-bridge.py becomes a thin loader shim: it injects sutando's workspace dirs (set_dirs), pins MEDIA_DIR to <workspace>/data/remote-media, registers the sutando send-allowed roots, then executes the canonical package source (packages/ag2-sparrow/ag2_sparrow/remote_gateway_bridge.py) in its own namespace with __package__ pinned — so every existing loader (startup.sh, runpy via remote-relay-bridge, the mock-gateway test harness with its multi-load env parsing and module-attribute mutation) sees the same module-level API as the pre-switch monolith. Reversible: revert this file. The two static design-guard tests that grep the src file for implementation strings (parse_markers wiring, interaction_type whitelist) now read the canonical package source instead. Verified: full mock-gateway harness green (tier fail-closed multi-load, reconcile, markers, media, a live loop iteration), file-attach + writeside + interaction-type + marker-no-leak + drift suites green, and the live bridge swapped to the shim (single instance, healthy startup, results delivering). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Coverage Gate✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 40%. Diff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
|
Review signal: no blocking findings. The live-switch shape looks sound to me: the I also checked the compatibility-sensitive parts: owner tier remains a local Validation run in an isolated
One minor note, not a blocker: importing the shim under a custom Reviewed by Qingyun's Codex. |
liususan091219
left a comment
There was a problem hiding this comment.
Triage change-request (owner-approved batch, 2026-07-12 sweep). Conditions found on the current diff:
- inadequate tests (source-grep, not behavior) — Replace bridge read_text/substring checks with behavioral import/header assertions
Justification: kb triage standards (source-grep test standard, voice/vision live-test policy, necessity/coverage checks) — see sonichi/sutando-pr-triage kb/.
Address the asks and push; re-request review to clear this. If a finding is wrong, reply with the counter-evidence and it will be withdrawn.
cr-reason: source_grep_tests
Box: remote-task transport (Source: remote gateway × Mode: task-file bridge) — follow-up to #2082, the "Task#3 live-switch" it scoped.
What
src/remote-gateway-bridge.py(895-line monolith) becomes an ~80-line loader shim over the canonical package client (packages/ag2-sparrow/ag2_sparrow/remote_gateway_bridge.py, published to PyPI asag2-sparrow0.2.0). The shim:tasks/,results/,state/) viaset_dirs()before the client evaluates import-time config;REMOTE_MEDIA_DIRto<workspace>/data/remote-media(transport default isSTATE_DIR/remote-media);execs the canonical source into its own namespace with__package__pinned.Step 4 is deliberate (not
import): the mock-gateway test harness loads this file several times under different env (tier fail-closed parsing) and mutates module attributes (rtc._ack_disabled = False); a cached module import satisfies neither.execgives per-load config re-evaluation and a single shared namespace — the pre-switch module contract, unchanged for every loader (startup.sh, runpy viaremote-relay-bridge.py, tests).Two static design-guard tests that grep the src file for implementation strings (
parse_markerswiring,interaction_typewhitelist) now read the canonical package source instead — the constraints still guard the real implementation.Why
Single source of truth: after #2082 (option A) the transport is package-canonical. Keeping a 895-line verbatim copy in
src/reintroduces the drift the package removed.Reversibility
Revert this one file (git) and restart the bridge — no other consumer changes in either direction.
Verification
src/remote-gateway-bridge.test.py(mock gateway): all green — multi-load tier fail-closed, ack/heartbeat disable-on-404, task-id path-traversal rejection, newline-forge clamp, marker archiving, media saves, reconcile ledger, one fullmain()loop iteration.tests/remote-gateway-file-attach,gateway-writeside-platform-card,gateway-writeside-attachments,remote-gateway-interaction-type,interaction-type-header,bridge-marker-no-leak,ag2-sparrow-drift,local-task-protocol: all pass.🤖 Generated with Claude Code