Skip to content

pa_lab: leased run_program and stop_program (Slice 5a) - #592

Draft
dayfine wants to merge 1 commit into
agentsfrom
lab/server-slice-5a
Draft

dayfine wants to merge 1 commit into
agentsfrom
lab/server-slice-5a

Conversation

@dayfine

@dayfine dayfine commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Base agents; independent of other open PRs; the diff shows only this change.

pa-lab could read console B but not act on it. This adds leased run_program and stop_program (Slice 5a of the agent-integration design, fork #131). Each call is one request record in the control plane. The lease check and the app checks run in one transaction. The daemon then sends the app's existing start/stop channel command carrying the request id, and settles the outcome from Lab/state.json. A retry with the same request_id returns the stored result and sends nothing.

  • Refused when the user holds the console, the agent has no lease or it expired, another program runs, the app is not running, the selected panel is not the requested program, the controller or video is not ready, or a lab script owns the channel lock.
  • The tools are served only by serve --actions. The read-only stdio mode used by .mcp.json is unchanged.
  • Contract change for review: run_program's preflight_token is optional in the v1 request until 5b brings preflight_program. The app has no command yet that runs prechecks without starting.
  • README.md documents how outcomes are correlated and what Slice 1's data cannot match by id; GUIDE.md gets a short "built, not switched on" section.

Testing: python3 -m unittest discover -s lab/server/tests -t lab/server (167 tests). New test_actions.py runs against the fake app: refusals, retries, a duplicate in flight, UI takeover during start and stop, lease loss, app restart between and during requests, the run ending before the response, and tickets surviving a daemon restart. No console was used.

Served only by serve --actions; the read-only stdio mode is unchanged.
Each call is one request record: lease and app checks in one transaction,
the app's start/stop channel command with the request id, and the outcome
correlated from Lab/state.json (by request id, or by time when the run
ended first). run_program's preflight_token is optional until 5b.
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