learningequality / learningequality/ricecooker
`remote/driver.py` + `--remote` interception — orchestrate the remote run
Open
@rtibblesbot is already working on this.
Since Jul 24, 2026.
TAG: new feature
- Dominant language
- Python
- Stars
- 31
- Forks
- 77
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 3
Description
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
A driver.py module providing run_remotely() — the orchestration that ties config, transport, and session into a full remote run.
Complexity: High
Target branch: main
Context
- Flags land on the base parser (
chefs.py:99). - Interception is in
main()(chefs.py:517). - Consumes
config.py(#703),transport.py(#704),session.py(#705). - The box can own secrets (
STUDIO_TOKEN, Google Docs, Box), independent of the client. tokens.py:39already readsSTUDIO_TOKENon the box, exactly as locally.
Out of Scope
- The out-of-band
remotesubcommand group and itsdoctor/cachecommands (cli.py).
Acceptance Criteria
General
-
--remote[=<name>],--env KEY=VALUE(repeatable), and--env-pass KEY(repeatable) are added to the baseSushiChefparser. -
main()hands a--remoterun torun_remotely(). -
main()does not callrun()for a--remoterun. - Remote argv is rebuilt from
sys.argvwith--remote,--token,--env,--env-passstripped. - Preflight verifies the host is reachable before syncing.
- Preflight verifies
uvis present on the box before syncing. - Preflight verifies
tmuxis present on the box before syncing. - The venv builds with
uv syncwhen the chef has apyproject.toml, elseuv pip install -r requirements.txt. - The venv is rebuilt only when the manifest hash changes.
- A chef with neither manifest falls back to a shared default venv with released ricecooker.
- The shared default venv lives at
<remote_root>/.default-venv/. - Optional
ricecooker_source = "local"syncs the developer's ricecooker checkout to the box. - With
ricecooker_source = "local", that checkout installs editable into the chef's venv.
Environment
- Box-owned secrets live in
~/.config/ricecooker/remote-envon the box (mode 600). - The run wrapper sources that file before running the chef.
- Box-owned secrets never transit the client.
- Client-supplied
--env/--env-pass/resolved token are forwarded viatmux set-environment. - Client-supplied values override box-owned ones for that run.
- Under
--remotethe client never prompts for a token. - The client forwards a token only if it resolves non-interactively.
- Client-supplied secrets are never written to the box's disk or the chef's argv.
Run lifecycle
- A live session is reported with its start time.
- A live session is attached, not restarted.
- A finished pane's previous exit code is reported.
- The finished pane is then killed.
- A fresh run starts after the pane is killed.
- No session → create it detached.
- After creating, attach to the session.
- Ctrl-C reaches the chef as SIGINT over the PTY.
- Ctrl-C does not kill the session.
- Detaching exits 0.
- Detaching prints instructions to reattach.
- After attach, the client reads
.ricecooker-remote/exitcodeand exits with it. -
run_remotely()creates<remote_root>/.ricecookerfilecache/when absent. - The file cache is passed to the chef as
<remote_root>/.ricecookerfilecache/. -
config_loggerwriteslogs/…on the box. -
tmux pipe-panecaptures the raw session to a log. - Both log paths are printed on exit.
Failures
- Plumbing errors are prefixed
remote:. - Plumbing errors pass ssh/rsync stderr through verbatim.
- A venv build failure leaves the session alive for inspection.
- A venv build failure shows the tail of the
uvoutput. - A chef exiting nonzero passes through unprefixed.
Testing
- Integration tests drive
run_remotely()through the fake-box runner. - Coverage includes the no-session path.
- Coverage includes the live-session path.
- Coverage includes the finished-pane path.
- Coverage includes exit-code propagation.
- Coverage includes the token reaching the environment.
-
tests/test_argparse.pyassertsmain()skipsrun()under--remote. -
tests/test_argparse.pyasserts the token lands in env, not argv. - One opt-in localhost-over-ssh e2e exercises a real run end-to-end.
AI usage
Claude (Claude Code) drafted this from the design spec; I directed the design and reviewed it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.