Repository navigation
Description
Task ID or area
area: TypeScript control-plane migration — scheduler ACK/failure compatibility facade
Technical direction
Core control-plane hardening
Intent
I need design feedback before implementation
Anchor type
Accepted RFC section or invariant
Optional anchor reference
typescript-control-plane-migration-v0 — scheduler follow-up transaction inventory (deletion condition for quota/scheduler_ack.py), §2.4 replacement, §3.2/§5 payoff contract
Gap, who is blocked, and exit
Current gap. loopx/control_plane/quota/scheduler_ack.py (457 lines) is the remaining Python facade for scheduler ACK and failure reporting. The RFC allows deleting it once its callers consume generated, heartbeat-receipt-bound hints. Generated receipt-bound scheduler-ack-current / scheduler-fail-current commands already go straight to the native TypeScript follow-up transaction (loopx/entrypoint.py native routing → scheduler/heartbeat_followup_cli.ts). Every other shape still goes through the Python facade, which calls the same TS transaction with require_heartbeat_receipt=false:
loopx quota scheduler-ack ...(always excluded from native routing);scheduler-ack-current/scheduler-fail-currentwithout both--turn-instance-idand--scheduler-host-facts-chunk, for example commands typed by hand;- the public in-process API
loopx.quota.record_quota_scheduler_ack(), which has no Turn argument.
The documentation explicitly promises this compatibility path. docs/development/control-plane-course/07-host-scheduler-and-heartbeat.md shows a manual scheduler-ack-current example without receipt binding and states that manually entered commands keep using the Python compatibility path. docs/heartbeat-automation-prompt.md also notes that regenerated prompt bodies do not update automations that are already installed, so older saved commands may still be running.
What the facade does besides launching TS. It selects the packet and state key, resolves current-hint identity, rejects a mismatched reset token or identity signature, requires an agent, requires a complete identity for host-match ACK, and projects the ok=false compatibility refusal. Several of these refusals happen locally, with zero cross-runtime calls. It does not mutate host automation TOML or SQLite; that stays in the external host adapter (scripts/codex_app_apply_rrule.py).
Who is blocked. Retirement of this facade under the migration RFC. Until the support contract is decided, the facade is neither a recorded permanent adapter nor deletable.
Exit condition. A maintainer decision on the question below, recorded in the RFC/ledger (EN + zh-CN), followed by the matching implementation PR or retention note.
Proposed scope
Decision needed.
Must LoopX keep supporting scheduler ACK and failure commands, and Python imports, that carry no originating heartbeat receipt, including commands already saved in installed automations? If so, which command and import shapes, and which minimum installed versions, are contractual?
Options.
| Option | Production LOC deleted | Compatibility impact | Main risk |
|---|---|---|---|
| A. Keep manual/unbound mode, but serve it from the existing native TS follow-up transaction; delete the Python facade | up to 457 (measured on the final diff) | None if command shapes and defaults are preserved | Local refusals (missing agent, token/signature mismatch, incomplete host-match identity) must stay at zero cross-runtime calls; moving every check behind a TS call would add one on those paths. Fresh App observation for host-match ACK must be kept. |
| B. Deprecate receipt-less ACK/failure (warning period), then remove | 0 now, 457 after the sunset | Old saved commands fail after the host RRULE already changed, leaving the ACK unrecorded; old failure commands stop recording suppression | High: needs a documented support window and installed-automation upgrade guidance |
| C. Record the facade as a permanent explicit compatibility adapter | 0 | None | Ongoing Python maintenance. Defensible only as boundary validation/projection, not as a second rule owner |
Suggested direction. Make A the target and record C as the current status until A is qualified: parity of manual defaults and refusals, no increase in crossings on refusal paths, public import compatibility, and installed launcher routing. Choose B only through an explicit sunset. In every option the existing TS transaction stays the only scheduler semantic owner, and no new leaf RPC is added.
Related doc corrections in any option. The RFC text that describes this facade as decision-free and says receipt-bound commands never start Python needs qualifying: host-match ACK first performs a fresh Python App observation (loopx/entrypoint.py), and the Unix launcher routes that case through Python.
Out of scope. Host automation TOML/SQLite mutation, which stays an explicit external-authority adapter. Scheduler cadence semantics, which are already TS-owned.
Intended base branch
main
Relevant files or commands
loopx/control_plane/quota/scheduler_ack.py(facade)loopx/quota.py(record_quota_scheduler_ack, neutral classification import)loopx/control_plane/quota/slot_accounting.py(classification constant only)loopx/cli_commands/quota_scheduler_followup.py,loopx/cli_commands/quota_registration.pyloopx/entrypoint.py,scripts/loopx(native routing)loopx/control_plane/scheduler/heartbeat_followup.ts,heartbeat_followup_cli.tsdocs/development/control-plane-course/07-host-scheduler-and-heartbeat.md,docs/heartbeat-automation-prompt.md,docs/quota-allocation.md- Tests:
tests/control_plane/test_scheduler_ack_current_host_binding.py,test_scheduler_compat_state_key.py,test_scheduler_host_failure_cache.py,tests/control_plane_ts/scheduler_heartbeat_followup*.test.ts
Activity
GZY-SUPER-HACKER commentedon Nov 10, 2026
Reading this against current
main(40740e343) to support the decision. One measured fact constrains every answer:The two ACK paths are indistinguishable after the fact.
evaluateSchedulerHeartbeatFollowupchecks the receipt only whenrequire_heartbeat_receiptis true (loopx/control_plane/scheduler/heartbeat_followup.ts:338-356); the compatibility path passesheartbeatReceiptTurnInstanceId: null.loopx/control_plane/scheduler/heartbeat_commit.ts:827-849). It is never written into state.heartbeat_commit: {schema_version, effect_id, request_digest, operation}(heartbeat_commit.ts:503-508) — no Turn id, no receipt flag.sourceis the samequota_scheduler_ackclassification on both routes.ackResult(heartbeat_followup.ts:244-276) norfailureResultemitsrequire_heartbeat_receipt, so a caller cannot tell whether its own ACK was receipt-checked.turn_instance_id: None, require_heartbeat_receipt: False(loopx/control_plane/quota/scheduler_ack.py:193-194).Consequence for this task: any of the three plausible contract answers — keep supporting receipt-less ACK, refuse it, or deprecate it on a deadline — needs the ability to distinguish records that were receipt-fenced from those that were not. Today neither the state file nor the command result carries that bit, and because it is not stored, the distinction cannot be reconstructed retroactively. A marker has to land before the contract changes, not with it.
Two bounded slices, in increasing contract weight:
receipt_bound: booleanto the follow-up result (ackResult/failureResult). The request already carries the value (SchedulerHeartbeatFollowupRequest.require_heartbeat_receipt), so this only surfaces what is already decided. Callers and log readers can then tell what happened. Roughly 10 lines plus a TS test.receipt_bound(and, if wanted, the receipt Turn id) to theheartbeat_commitmetadata with a schema-version bump. New records become classifiable; existing ones stay unknown by construction. This changes a persisted contract, so it should be your call and probably a separate slice.I would take (1) regardless of the contract decision, because it is the minimum needed to make the decision auditable; (2) only if the classification should survive the process that produced the ACK.
If either shape is acceptable, I will implement it as a scoped PR with tests. Caveat: I have not run a live host automation for this. The claims above are read from the current tree, and the shared-commit fact is what makes the state shape identical in both routes.