"[delegate worktree] Run all file edits, tests, and git commands inside this worktree:…
- User
"[delegate worktree] Run all file edits, tests, and git commands inside this worktree: /home/ops/learn-ukrainian/.worktrees/dispatch/glm/fix-7269-step5-comms Do not switch branches in the main checkout. If you need a fresh base, run
git fetch origin mainINSIDE this worktree —originhere points at the canonical GitHub remote and fetch works from any linked worktree. NEVER use the primary checkout as a source of freshness (nogit -C <primary> pull/fetch/checkout); it is the human's interactive home.[shared project interpreter] Never create, copy, symlink, activate, or use a
.venvinside this worktree. Run every project Python command with/home/ops/learn-ukrainian/.venv/bin/python(the absolute primary interpreter), neverpython,.venv/bin/python, orpython -m venv .venv. Do not changePYTHONPATHmerely because the worker cwd is a worktree. Sparse-checkout is active: these top-level trees are NOT present: curriculum, wiki. If you need them, re-dispatch with --sparse-include or --full-checkout (do not invent content for missing paths).[optional delivery signal] Commits on your dispatch branch are sufficient proof of delivery on their own. If you finish with zero commits (a verified no-op), you MAY end your final response with one machine-readable line as positive proof:
DELIVERABLE: {\"outcome\":\"no_change\",\"reason\":\"why no changes are required\"}. This line is optional — its absence never fails the dispatch.#7323 — #7269 step 5: migrate
comms_routerto MonitorContextGLM-5.3, LOCAL-ONLY (z.ai). This is real paid-lane fill: unused GLM is waste.
Parent #7269 / #7323. Design:
docs/design/monitor-api-app-factory.md§4.3. Inventory:docs/design/monitor-api-router-inventory.mdstep 5 row.ROUTING_CARD_V1
- tier: practical
- model_x_harness: glm / glm-5.3 @ high (opencode, LOCAL-ONLY)
- why_this_tier: mechanical router migrate; China-egress OK for this infra code on the VPS, never CI
- owned_paths:
scripts/api/comms_router.pyand its tests / inventory seam list only - acceptance_cmd: see Acceptance
- alternatives_considered: cursor (taken by subscription-usage PR), agy
- parallel_free_seats: cursor
fix-subscription-usage(disjoint: not comms_router)
Scope
Migrate
comms_router.py(~1898 lines) toDepends(get_ctx)instead of module globals. Delete exactly the 11 OPSEC seams this step’s inventory row lists — sweepKNOWN_SEAMScount must drop by exactly 11. Assistant
Monitor API is down; reading the fallback rules, design doc, and the step-1 pattern.
Assistant
Now the step-1 pattern and the MonitorContext:
Assistant
Now let me read the current sweep test to see the exact comms seams:
Assistant
Let me look at the seam-count script and the registry's KNOWN_SEAMS:
Assistant
Now let me identify the exact seams and consumers. Checking
message_plane,legacy_broker_report, andai_agent_bridgeusage:Assistant
Let me get the definitive current seam list by simulating the recorder:
Assistant
Let me check whether
/api/fleet/facade/broker-reportis exercised or skipped in the sweep, and its expected statuses:Assistant
Let me check all readers of
FLEET_COMMS_ROOTand then empirically test the two risky seam deletions:Assistant
Let me check how
agent_runtime.usage(which already resolves the real primary checkout today) survives the sweep:Assistant
Let me examine the fleet facade route guard and then just empirically run the sweep with the risky deletions to settle it:
Assistant
Blockers mapped. Now let me read the three main comms test files to plan their migration:
Assistant
Design is settled. Checking the last details before writing code:
Assistant
All details resolved. Now writing the migration. First,
comms_router.pyheader and helpers:Assistant
I accidentally introduced a junk line — fixing:
Assistant
Now the DB helper functions:
Assistant
Now the delivery-expiry sweep trigger:
Assistant
Now the route handlers.
list_messages,list_conversations,get_conversation:Assistant
active_processesanddetect_zombies:Assistant
comms_stats,broker_health,message_plane_status:Assistant
Now
_scan_track_progress(CURRICULUM_ROOT):Assistant
Now the
batch_progressroutes and the live-activity scanners:Assistant
Now the
live_activityroute and remaining channel/inbox routes:Assistant
Now
agent_activity,comms_inbox, and the three v1 metrics routes:Assistant
Routes mounted, ruff clean. Now the sweep fixture:
Assistant
Now mirror in the count script:
Assistant
Count dropped 186→176 with the sweep green-pending. Let me run the sweep now to validate the current state:
Assistant
Green. Now the decisive experiment — temporarily delete the
broker_reportseam to test my blocker analysis:Assistant
Empirically confirmed: the broker seam deletion breaks the sweep via the unmigrated fleet route (
fleet_router.py:598). Restoring it with documentation of the mis-attribution:Assistant
Sweep fixture done. Now the comms tests. First the expiry-sweep test:
Assistant
Now the remaining call sites in that file: