Skip to content

lab server: cfr_batch, allowlisted console lines under the lease (Slice 5b) - #547

Draft
dayfine wants to merge 2 commits into
agentsfrom
agents-mcp-slice5b
Draft

dayfine wants to merge 2 commits into
agentsfrom
agents-mcp-slice5b

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Depends on #518

Base agents. Until #518 merges, the diff also shows #518's commit (4334cc5); this PR's own change is 1aacde2.

Slice 5b from #131 adds cfr_batch, the debug-only console batch, as a leased action. It sends lines the allowlist (pa_lab/cfr.py) accepts as one channel request, using #518's owner/request/claim lines, and returns the app's journal. console://B/save is marked stale (cfr_batch) before anything is sent, and the mark survives a daemon restart. Tested with the lab/server unit tests (184, 26 of them new, all against the fake lab): every allowed and refused line form, the refusals, the journal outcomes, save staleness, retries, daemon and app restarts, a busy app and a foreign channel owner. No console or app was touched.

Decisions taken (each picks the conservative option; overturn any of them):

  • Allowlist: only controller commands (press dpad stick wait taps walk) and screen reads (shot shots detect wait_for expect game_open). Refused: every channel command, close_game, history, snapshot, state, game-registered commands, comments, blank lines and lines not in canonical form. The CAPTURE button and the image argument (a file path) are refused too.
  • Every number is bounded (hold/release ≤ 10 s, wait/timeout ≤ 30 s, ≤ 20 taps, ≤ 10 shots), and a batch's worst case must fit in 60 s. That makes the call synchronous: it waits for the journal and returns a terminal record, instead of a ticket like stop_program's.
  • Preconditions are stricter than the app's: program stopped on a program panel, controller ready, video live. Bad lines and a bad app state get a stored refused record, so they appear in the audit log.
  • The save is marked stale before the batch is sent, even when the app never takes it, so a crash between sending and marking cannot leave a known save.
  • A failed batch line (an expect timeout, say) is completed with outcome: line_failed and failed_line, not failed: the journal is the answer. Only a refusal on the owner lines is failed, with app_unavailable.
  • No journal in time: the request is withdrawn (refused, timeout) if still in the inbox; if the app took it, the record is failed, timeout ("may have run in part"). A retry of a ticket left pending by a daemon stop collects the journal; an app restart fails it.
  • The result returns the journal text only; shot PNGs stay in the outbox (use shot for an image).

ControlPlane.begin_action stores a leased call once with the lease check;
the pending ticket remembers the app instance (migration 2) and observe
resolves it from the app's terminal transition. stop_program sends a fixed
owner/request/claim/stop request; the channel owner comes from the config.
…ce 5b)

cfr.py checks every line (controller and screen-read commands only, bounded
numbers, a 60 s worst case) before anything is stored or sent. cfr_batch
needs a stopped program, a ready controller and live video, marks the save
fact stale (cfr_batch) before sending, and returns the app's journal.
A retry collects a pending batch; an app restart fails it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant