Skip to content

pi-python v0.7.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 12:09
· 103 commits to main since this release
7cb9e23

This release is about the first run. pi-agent-cli-lc now has a console script with the name of the package, so uvx pi-agent-cli-lc works, and a user who has no model and no key can set both with python -m pi_agent_cli --setup. An ACP client that can run a terminal login (Zed) gets the same dialog as a login. Nobody has run that login inside Zed yet. Fixed has the benchmark runner that showed the verifier's tests to the agent, -p that exited 0 after a failed model call, and the extension API defects of audit batch 9. Changed has the new version numbers: the extension packages need the new core. Known issues says what does not work yet.

Added

  • A console script with the name of the package (pi-agent-cli): pi-agent-cli-lc starts the same function as pi-agent-cli, which stays. uvx <package> runs the executable that has the name of the package, and it stops with an error when the package has none. The package had only pi-agent-cli, so uvx pi-agent-cli-lc==0.6.0 printed "An executable named pi-agent-cli-lc is not provided by package pi-agent-cli-lc". The ACP registry starts a PyPI agent only in this form (uvx <package> <args>; it has no --from), so a registry entry needs this script. It is on PyPI from 0.7.0. uvx --from pi-agent-cli-lc pi-agent-cli works with every release. Test: packages/pi-agent-cli/tests/test_console_scripts.py.
  • The README tells how to start the agent in Zed as a custom agent (docs): the section "In Zed (custom agent)" has the agent_servers entry (uvx --from pi-agent-cli-lc), the place of the model and key settings, and the entry for a checkout. The command of the entry was run with the published 0.6.0 package: the agent answered initialize in an empty home. It was not run inside Zed.
  • --setup, and a terminal login for ACP clients (pi-agent-cli): a user who has no model and no key can now set both from a terminal. python -m pi_agent_cli --setup asks for the provider (OpenAI, Anthropic or DeepSeek), the model and the key. It writes a [model] table to agent.toml (a new file, or the end of a file that has no such table; the text that is there stays to the byte) and the line NAME=key to local.env (mode 0600 on POSIX). The key is read without echo and is never printed, logged or put in agent.toml. It stops, before the first question, for a file that is not TOML, for a [model] table that sets no provider, and for a home that has only the old config.toml. The agent also offers the dialog to the client as an authentication method (pi-setup, "Set up model and API key"). A client that announces auth.terminal (Zed) gets a method of type terminal. A client that announces only _meta["terminal-auth"] (older clients, the registry validator) gets a method with the command in _meta. Other clients, zypi included, get authMethods: [] as before. While the agent has no usable model, session/new answers auth_required (-32000) to a client that can run the login, and the agent reads agent.toml and local.env again at session/new, session/load and session/resume. session/load and session/resume never refuse. A key that --setup replaces needs a new agent process (load_local_env never overwrites a variable that is set). Not run inside Zed. A script that acts as the client ran a live agent process on Linux (initialize, session/new, the login command in a pseudo-terminal, session/new, authenticate). Design: docs/specs/2026-10-28-acp-terminal-auth-setup-design.md. Tests: packages/pi-agent-cli/tests/test_setup_command.py, test_acp_auth_methods.py.
  • The product site for zycode (web/, docs): a static site at https://zycode.dev, in English (/) and in Chinese (/zh/). It is not a Python package, and no file of a release contains it. web/README.md has the commands, the deploy, and the rules for what the site may claim (every claim has a source in the repository). The <head> of a page has the canonical link, the hreflang links, the Open Graph and Twitter tags, JSON-LD data (WebSite and SoftwareSourceCode) and the icons; robots.txt and sitemap.xml are generated. The new workflow web-ci.yml runs npm run check and npm run build for a PR that changes web/. A merge to main that changes web/ deploys the site by itself (Cloudflare Workers Builds, not GitHub Actions). The root README.md links to the site.

Changed

  • The release workflow builds the Linux binary on ubuntu-24.04, not on ubuntu-latest (CI): GitHub moves the label ubuntu-latest to Ubuntu 26. A binary that is built there can need a newer glibc than the 2.39 of Ubuntu 24.04, and then a machine with Ubuntu 24.04 could not start it. The job build-tui in release.yml now names the image, as TUI CI does (ADR6) and as build-tui-macos-arm does with macos-14. Nothing changes for the files of a release: the build of v0.6.0 ran on ubuntu-24.04 already. The other jobs of release.yml (tests, Python packages, publishing) still use ubuntu-latest; they ship no binary.

  • The documentation says that the Linux binary needs glibc 2.39 or newer (docs): docs/TUI-AND-CODE-AGENT.md, Option A. The binary of v0.6.0 has GLIBC_2.39 as its highest versioned symbol, so a system with an older glibc cannot start it (Ubuntu 22.04 has 2.35). Option B (build from source) works there.

  • The workflows use the Node 24 versions of three GitHub Actions (CI): actions/upload-artifact v4 to v6, actions/download-artifact v4 to v7, and actions/cache v4 to v5. GitHub removed Node 20 from its runners on 2026-09-23. It runs the old versions on Node 24 and prints a warning. The new versions change only the runtime; the inputs that the workflows use are the same. arduino/setup-protoc@v3 stays: it has no release for Node 24, and it works on Node 24 (the runs of 2026-10-26 passed). download-artifact runs only in the jobs that publish, so a dry run of release.yml does not test it.

  • A change of the Python agent alone runs one test target of the pager, not the whole TUI CI (CI): tui-ci.yml started for packages/pi-agent-cli/pi_agent_cli/** and packages/pi-agent-cli/tests/_tool_agent.py, because the end-to-end tests of the pager (python_agent_e2e) talk to the agent. But it runs ten suites and takes 18 to 35 minutes, and a change of the Python agent can change only that one target. The runs for the PR of --setup took 25 to 35 minutes, and the first two failed on a Rust test that the PR does not touch (fixed in #47). Now these two paths start the new workflow tui-e2e.yml, which runs that target alone. It restores the cache of the test job of tui-ci.yml and never saves one. tui-ci.yml runs for tui/**, scripts/tui_baseline.py, scripts/tui_baseline.toml and its own file, and it still includes the end-to-end tests. A change of both runs both workflows. Tests: scripts/tests/test_tui_baseline.py keeps the two workflows in line (paths, command, environment, install lines, cache key).

  • The cache of the TUI CI keeps its key when GitHub updates the runner image (CI): Swatinem/rust-cache puts the version of every Rust toolchain on the runner into the cache key. The image has its own stable, and the image of 2026-10-25 changed it from 1.99.0 to 1.99.1. The key changed, no cache matched, and the test job built everything again: 35 minutes, 31 of them for the build (18 minutes with the cache). Now the jobs of tui-ci.yml and tui-e2e.yml that install the pinned toolchain make it the default and uninstall the other toolchains before the cache step (the step Keep only the pinned Rust toolchain). So the key depends on the pinned toolchain, on the files of tui/ and on the CARGO_* and RUST_BACKTRACE variables of the workflow, and not on the image. The first run on main after this change builds everything once and saves the cache (only main saves). add-rust-environment-hash-key: false is not a substitute: it also removes the hash of Cargo.lock from the key, so the key never changes and the cache is saved only once. Tests: scripts/tests/test_tui_baseline.py keeps the step equal in every job and before the cache step, and keeps the hashed variables equal in the two workflows.

  • The PyPI pages link to the site (packaging): the [project.urls] of the seven pyproject.toml files have Website = "https://zycode.dev", and the README of pi-agent-cli-lc says that the agent is the one of zycode. The link shows on PyPI from this release.

  • New version numbers (all Python packages, TUI): pi-agent-core-lc, pi-agent-harness-lc and pi-agent-cli-lc go from 0.6.0 to 0.7.0. The three pin each other with ==, so install them at one version. zypi --version and the agentInfo of the agent show 0.7.0 (the Cargo.toml files of pi-pager-bin and pi-version and tui/Cargo.lock carry the version of pi-agent-cli-lc, and a test checks it). The extension packages are released with the core, so all four now require pi-agent-core-lc>=0.7.0, and pi-dynamic-workflows-py also requires pi-agent-harness-lc>=0.7.0. pi-web-access-py, pi-goal-x-py and pi-dynamic-workflows-py go from 0.3.0 to 0.4.0, and pi-mcp-py goes from 0.1.0 to 0.2.0. Their behaviour has not changed since 0.6.0 (pi-dynamic-workflows-py has a new comment in runtime.py); the new requirement and the Website link are the changes. The publish step skips a version that is on PyPI already, so a new requirement needs a new version number.

Fixed

  • The first turn without a model named a missing package (pi-agent-cli): with no [model] table the provider is mock. LangChain has no such provider, and in an install without the langchain package the turn failed with "Provider 'mock' needs init_chat_model from the 'langchain' package: pip install langchain". That text hid the real cause. Now the turn fails with "No model is set. Run the agent with --setup, or add a [model] table to <agent.toml>." The scripted LLM (PI_USE_MOCK=1) and the real providers are not changed. Test: packages/pi-agent-cli/tests/test_first_run_errors.py.
  • -p exited 0 with an empty line when the model failed (pi-agent-cli): the turn ended with stopReason="error", and the headless runner printed the empty answer and returned 0. Now it writes error: <reason> to stderr and returns 1, and stdout keeps only the text of an answer. Behavior change for a script that read exit status 0 after a failed model call. Test: packages/pi-agent-cli/tests/test_first_run_errors.py.
  • The benchmark runner showed the verifier's tests to the agent (pi-agent-cli): DockerContainerSession.setup() copied the task's tests/ into the container as /tests when the container started. The agent has a shell in that container, so it could read test.sh, test.patch, grader.py and test_outputs.py. This was so from the first version of the runner (2026-09-04). Now setup() copies nothing. run_verifier() installs /tests after the agent is done, and first removes any /tests that the agent made. DeepSWE's task.toml asks for this ([verifier] environment_mode = "separate"). Affected results: a scan of all 65 saved trajectories found one Terminal-Bench pass that read /tests (extract-elf, 2026-09-07), and one --no-docker run that read the task cache with tests/ and solution/ in it (polyglot-c-py, 2026-09-10). The first no longer counts. The report does not use the second. Numbers and method: docs/benchmarks/FRONTIER-HARNESS-30-EVAL-REPORT.md, section "数据有效性声明". Test: packages/pi-agent-cli/tests/test_docker_runner_verifier_isolation.py.
  • A DeepSWE run scored -1 when the agent had committed a file with the name of a hidden test (pi-agent-cli): the task text tells the agent to work on a new branch and to commit. DeepSWE's grader.py assumes that HEAD is the base commit. It resets the files that test.patch touches with git checkout HEAD -- <file>, and it deletes a file only when HEAD does not have it. A file that the agent had committed under the name of a hidden test (tests/test_multipart_response.py in httpx-multipart-response-parsing) stayed, git apply test.patch failed with "already exists in working directory", and the run scored -1 without any test run. The official flow is not affected: it applies the agent's diff to a fresh container. Now setup() records HEAD, and run_verifier() moves HEAD back with git reset --mixed before the verifier starts. Only HEAD and the index move; the files stay as the agent left them. This applies only to tasks whose tests/ has grader.py and config.json; Terminal-Bench tasks keep their history (for sanitize-git-repo the new history is the answer). Affected results: one trial. Of the 6 trials of the 100-turn rerun (2026-10-26), httpx-multipart-response-parsing scored -1; a re-grade of its saved workspace with the fix gives F2P 122/122 and P2P 1272/1272. Three other trials of that rerun also had commits (expr-try-catch-errors, katex-multicolumn-array-spans, meriyah-explicit-resource-declarations); a re-grade with the fix gave the same counts as before. A search of all saved verifier_output.txt files (the 60-turn DeepSWE trials of 2026-10-16 included) finds this error in that one trial only. Test: packages/pi-agent-cli/tests/test_docker_runner_verifier_head.py.
  • An extension did not find its own entries with get_custom_entries (pi-agent-core, pi-agent-harness): the method returned the entries that the session had when the extensions loaded. An entry that an extension wrote with append_entry in the same session was not in the list. Now the list holds the entries of the session first and then the entries that were written after that, in order. An entry that the session has not written yet has an empty id. goal-x reads its state only at session_start, so it was not affected. Audit F7-02. Test: packages/pi-agent-harness/tests/test_harness_extension_state.py.
  • ExtensionAPI.run_async raises RuntimeError when no event loop runs (pi-agent-core): it called asyncio.get_event_loop(). With no running loop, Python 3.12 and 3.13 made a loop that never ran (and gave a DeprecationWarning), so the task never ran; Python 3.14 raises RuntimeError. Now the method uses get_running_loop() and closes the coroutine, and all Python versions raise at once. Behavior change for an extension that called it outside a running loop: it got a task that never ran, and now it gets the exception. No extension in this repository calls run_async. Audit F7-03. Test: pi_agent_core/tests/test_extension_api_rules.py.
  • An extension that registers a command name that cannot be used fails to load (pi-agent-core): the harness finds a command by the text between the / and the first white space. A name that is empty, that holds white space, or that starts with / could never be run, but the clients were told about it. register_command now raises ValueError for such a name, as register_tool does for a tool name. In activate() this fails the load of that extension and rolls back its other registrations; the other extensions still load. Behavior change: such an extension used to load. Audit F7-04. Test: pi_agent_core/tests/test_extension_api_rules.py.
  • A directory extension that failed to import stayed in sys.modules (pi-agent-core): the loader puts the module in sys.modules before it runs the file, as the import system does, but it did not take it out when the file raised. The name (_pi_ext_<file name>) is the same for the extension files of all projects, so a half-written module could be found later by that name. Now the entry is taken out, and an older module of the same name is put back. This is also so for sys.exit(). The failure is still in failed, with the same text. Audit F7-05. Test: pi_agent_core/tests/test_extension_loading_rules.py.
  • The harness logs a warning when an extension tool takes the name of a built-in tool (pi-agent-harness): the extension tool replaces the built-in tool. This is allowed, and it did not change. But the permission check reads the annotations of the tool that is in place, so an extension tool that declares itself read-only and is called bash is not asked about in ask mode, and nothing was logged. Now the harness logs one warning with the tool name and the extension name. Audit F7-06. The harness still sends no ToolsUpdateEvent when a tool is added after the load: nothing in the ACP layer reads that event. Test: packages/pi-agent-harness/tests/test_harness_extension_state.py.
  • Three notes in the Phase 7 spec are corrected (docs): §3.5 said that session_start is before_agent_start; it is sent once, after the extensions load (§4.3). §3.4 and the docstring of ExecuteFn now say that the harness calls execute(tool_call_id, params, signal, on_update) with four positional arguments, and that a function that takes two fails with TypeError when the tool is called. §14 lists the fields that go into the hash of a journal entry (timeout_ms is not one of them). Audit F7-07 to F7-09.
  • The cleanup of the file queue could keep the temp file of an expired pair (TUI, pi-file-utils): a pair is a temp file and its <temp>.meta.json, and the age of a pair is the enqueued_at in the sidecar. cleanup_queue_dir deleted files while it walked the directory. When the walk met the sidecar first, it deleted the sidecar, and then the temp file had no sidecar and was judged by its own modification time, so it could stay until a later sweep. The order of the walk is the order of the file system (by hash on ext4, by creation on tmpfs), so the same code passed on one file system and failed on another. The test cleanup_orphans_uses_sidecar_age_for_pairs failed on CI after a runner image update. Now the function decides every age first and deletes after that. The same entries are deleted, with the same counts. Test: cleanup_orphans_removes_expired_pairs_whatever_the_listing_order (32 pairs, half with the temp file first and half with the sidecar first).

Known issues

  • The allowlist egress mode of the benchmark runner does not filter (pi-agent-cli): the Terminal-Bench tasks use it. The runner passes only proxy variables to the container, and EgressPolicy.allowed_hosts goes into run.json and nowhere else. A test on 2026-10-16 reached example.org, huggingface.co and httpbin.org through the proxy. The official list itself has github.com. One agent used this to download the reference solution of its own task, so that run does not count. --egress-mode no-network rules this out (a task that needs apt-get then fails). --no-docker runs share the file system with the agent. Use them for smoke tests only.
  • Some flags and settings have no effect: in the interactive UI, --system-prompt-override and --rules do nothing, and --allow and --deny do not reach the agent. zypi --help still lists flags from the upstream project that nobody has checked one by one. On the settings page, the items other than the permission mode may have no effect with the Python agent. remember_tool_approvals and default_selected_permission were not tested.
  • [ui.status_line] has no context or cost items with the Python agent: the agent does not tell zypi the size of the context window, the tokens in use or a cost, so these items stay empty, and a script gets no context_window.*, cost.total_cost_usd, workspace.branch or workspace.repo_root. The rest of the row is drawn.
  • The user guide has no way to open it: the 7 pages are in the binary, but nothing in the UI opens them.
  • --session-id and --continue get slow with thousands of sessions (TUI, pi-agent-cli): the agent lists its session directory again for each page of session/list, so reading all pages costs pages × directory size. --session-id reads all pages. At 1,000 sessions it takes 1.3 s on Linux and 1.8 s on Windows. At 5,000 sessions it takes 28 s and 34 s, and the lookup stops after 30 s. --continue takes 0.6 s and 0.8 s at 1,000 sessions, and 10 s and 12 s at 5,000. Below 1,000 sessions this is fine, and the owner decided to leave it (plan decision 18).
  • Two agent processes that use one home can still make two sessions with the same id (pi-agent-cli): inside one agent process, an id that a client chose is reserved while its session is open, so a second session/new with that id is refused. Two processes do not see each other's reservations. Both can make the session; the first to write its file wins, and the first message of the other is refused (a session with this id already exists).
  • An id that no session ever had also opens with session/load (pi-agent-cli): the agent cannot tell such a UUID from the id of a blank session (a session with no file), so it opens an empty session. zypi export <uuid> of such an id says that the session has no conversation content, and not "not found".
  • pi-mcp-py is Alpha (0.2.0): it has no OAuth, MCP resources, prompts, sampling, roots, elicitation or tools/list_changed. The MCP SDK hides the error of a failed POST request of a legacy SSE server, so a call to a dead SSE server ends only after the call limit of 120 s. A thread that Zed creates before the first worktree of the project has loaded gets an empty mcpServers list (zed#64611). The agent cannot tell this from "no servers", so such a thread has no MCP tools and no notice; a new thread works. zypi has no setting for MCP servers, so only an editor can pass them. The package takes the annotations of a server as given: in the ask mode, a tool that its server marks as read-only runs without a question. Nobody has used the package in the real Zed window; its tests use real child processes, the real agent and ACP over stdio.
  • Tested on Linux only for the latest changes: the end-to-end and pseudo-terminal scripts run on Linux (WSL2); the tests of pi-mcp-py also run on Windows. Nobody has started the macOS binary (CI builds it). There is no Windows binary. The Landlock layer of the sandbox was not tested: the kernel of the test machine (5.10) has none.