feat(pair): add an agent-facing CLI for live notebook sessions - #10777
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
Bundle ReportChanges will decrease total bundle size by 103.28kB (-0.39%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: marimo-esmAssets Changed:
Files in
|
Coverage Report for ./frontend
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved URL construction, production bootstrap prompt, and Windows integration-test issues block approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds live notebook execution, offline docs, and session-aware agent prompts to marimo pair.
Changes:
- Added streaming
pair executeand offlinepair docscommands. - Added credential handling and session-aware prompts.
- Added CLI, client, frontend, and integration tests.
File summaries
| File | Reviewed changes |
|---|---|
tests/_cli/test_pair_integration.py |
Live execution coverage; Moderate (2 votes): select.select on pipes is not Windows-compatible. |
tests/_cli/test_pair_client.py |
Client behavior and streaming tests. |
tests/_cli/test_cli_pair.py |
CLI command coverage. |
tests/_cli/fixtures/pair/execute-success.sse |
Successful execution SSE fixture. |
tests/_cli/fixtures/pair/execute-failure.sse |
Failed execution SSE fixture. |
tests/_cli/_pair_server.py |
Integration server fixture. |
marimo/_cli/pair/commands.py |
Execute, docs, and prompt commands; Moderate (2 votes): prompt hardcodes uv run marimo in installed environments. |
marimo/_cli/pair/client.py |
HTTP/SSE execution client; Critical (3 votes): endpoint construction breaks URLs containing query parameters. |
frontend/src/components/editor/actions/pair-with-agent-modal.tsx |
Session-aware pairing modal. |
frontend/src/components/editor/actions/pair-with-agent-commands.ts |
Agent command generation; Moderate (3 votes): production prompt incorrectly directs agents to run uv run marimo. |
frontend/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts |
Frontend command-generation tests. |
Review details
Suppressed comments (1)
marimo/_cli/pair/client.py:173
- A truncated chunked HTTP response from
http.clientcan raisehttp.client.IncompleteRead, which is anHTTPException, not anOSError. That exception bypasses this handler and produces a traceback instead of the promisedPairError/exit status 1 for an unconfirmed execution; include the HTTP client exception type in the connection-read handling.
except OSError as error:
write_buffered_output()
raise PairError(
"The execution response ended before completion was confirmed."
) from error
- Files reviewed: 11/11 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
54f6af9 to
c7ab2e4
Compare
Stream scratchpad execution over SSE, list sessions, resolve a session from a notebook path, and read server URLs from the local registry. Tokens travel in headers only, and every server response is validated before use.
c7ab2e4 to
9361811
Compare
execute runs Python in a live kernel and prints one JSON result, or one JSON failure with a next step an agent can run. notebook list finds servers and sessions. --help is a copyable procedure. prompt no longer checks for an installed skill, because the CLI replaces it.
…modal The Pair with an agent modal emits the marimo pair --help bootstrap with the server URL and current session id. The prompt never contains the token.
Start a real marimo server in a subprocess and run the CLI against it, so the streaming, cancellation, and failure paths are checked end to end.
There was a problem hiding this comment.
🟡 Changes recommended
Default behavior contradicts the PR description, and execution parsing, command quoting, launcher portability, and HTTPS discovery need correction.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 5
- Review effort level: Balanced
The workflow snippet installs through ctx.packages.add, and the rules cover package installs, empty cells, and deletions. Wording follows the marimo-pair skill.
…nfirmed Recovery commands shell-quote the URL and session id and embed the cell id as a Python literal. A malformed execute event now raises the same unconfirmed-completion error as a dropped connection, so the caller inspects instead of retrying. Registry entries on port 443 use https.
9361811 to
dbc2047
Compare
manzt
left a comment
There was a problem hiding this comment.
I noticed that uv run ends up in a lot of the prompts. Is that something that users would see when we make a release?
Keep the current Pair with Agent experience stable while the CLI-backed prompt is prepared behind an opt-in flag. Restore agent-specific flags, installed-skill validation, and token handling, and use `uvx marimo@latest` for generated commands so the modal does not assume a local uv project.
3684666 to
8cc74a1
Compare
## 📝 Summary Add `MARIMO_PAIR_NEXT=1` to opt into CLI-based pairing from `pair prompt` and all four Pair tabs. The preview skips skill installation and directs agents to `marimo pair --help`. Keep the existing skill flow when the flag is off. Share the prompt template and launcher through page configuration. Include the known notebook file and current session, format terminal commands across multiple lines, and teach file-first selection so agents can reconnect after a page reload. Explain `--token-file` and `MARIMO_TOKEN` in basic help. Allow an empty token entry to skip file creation and retain the environment fallback. Preserve hidden token entry, private token files, and raw-prompt token masking. The preview uses local `uv run marimo`; switching to `uvx marimo@latest` remains a separate change after publication. Follow-up to #10777.
📝 Summary
Add
marimo pair, a small CLI that lets a coding agent work inside a live notebook session.pair executeruns Python through the existing scratchpad endpoint and prints one JSON result by default, with--streamto write output as it arrives. Every failure returns the same JSON shape with anextfield that holds a filled-in recovery command, so an agent that hits a stale session, a missing session, or a kernel error knows the one thing to run next. Interrupted or malformed responses report "outcome unknown" and tell the agent to inspect rather than retry.pair notebook listfinds live sessions from the local server registry or from--url, grouped by notebook, in the same shape asmo notebook list.pair docsexposes the bundled notebook guidance offline.pair promptand the Pair with an agent modal generate a help-first bootstrap that includes the current session. The--helptext is a copyable procedure written for agents: it prefers Code Mode for every mutation, including package installs throughctx.packages.add, and its wording follows the marimo-pair skill.Removes the skill-detection warning from
pair prompt, since the CLI is now the agent's entry point and the flags stay as hidden no-ops. Tokens never appear in arguments or prompt text; the CLI readsMARIMO_TOKENor--token-file. Adds client, CLI, frontend, and live-server coverage.Closes MO-7667