Repository navigation
refactor(tui): rename the Grok leftovers to zypi and fix the hints that name missing commands (stacked on #7) - #8
Merged
Merged
Conversation
zy1233
changed the base branch from
codex/rust-agent-runtime-removal-plan
to
main
October 6, 2026 15:29
…ng commands from the copy toasts The home was shown as ~/.grok or $GROK_HOME in the settings footer, the copy toast's backup path and the doctor notes, although it is ~/.pi-python (or $PI_HOME, see pi-home). Users were sent to files that do not exist. The copy toasts pointed at `grok wrap`, `/minimal`, `/doctor`: zypi has the subcommands `wrap` and `doctor` and the --minimal flag, and no such slash commands. Add a test that no toast names a missing command.
… the old ids as aliases Persisted ids become zypinight / zypiday and the labels zypi Night / zypi Day. from_name() still accepts groknight, grok-night, GrokNight, grokday, grok-day (and dark / light / day), canonical_name() normalizes them, so an existing config.toml keeps working and shows the renamed theme as selected. The settings footer no longer advertises asking Grok about the docs (there is no such feature); it says where the settings are saved. Setting text no longer mentions /minimal, /fullscreen, /doctor or Grok STT.
…alls alias ssh='grok wrap ssh' `zypi doctor fix ssh-wrap` wrote an alias for a command that does not exist into the user's shell rc, which breaks ssh. It now writes alias ssh='zypi wrap ssh', in a block marked '# >>> zypi doctor >>>'. Report titles, notes, fixes and the startup / SSH tips name zypi doctor, zypi wrap and --minimal instead of /doctor, /copy, /minimal and grok.
The hints told users to run worktree gc / rm / db rebuild; zypi has no worktree subcommand. Keep the one piece of advice that holds (delete what is listed).
--minimal welcome screen and trust prompt, startup timeout message, voice toast, status-line payload error, zypi wrap error prefix.
…the list of untouched names
discover_context_files looks for AGENTS.md and AGENTS.MD (and CLAUDE.md and CLAUDE.MD) in every directory and skipped repeats by the resolved path string. On a case-insensitive file system the two spellings are one file, and Path.resolve keeps the spelling it was given on macOS, so the project's AGENTS.md was read twice and reached the prompt twice. The bug dates from the Phase 5 prompt engine; main's test_context_files_are_loaded_whatever_the_trust is the first test to catch it, and it failed on macOS on main itself. Repeats are now skipped by file identity (device and inode; the path where there is no inode), which also covers hard links. The new test makes one file with two names by itself on a case-insensitive file system and with a hard link elsewhere. Without the fix it fails together with main's test.
zy1233
force-pushed
the
codex/branding-cleanup
branch
2 times, most recently
from
October 6, 2026 15:33
00df03f to
0d6867b
Compare
zy1233
added a commit
that referenced
this pull request
Oct 10, 2026
…8, run on WSL2) (#9) ## Summary The macOS half of `docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md` is merged (#6 to #8). This is the Linux half, run in WSL2 (Ubuntu 24.04, kernel 5.10 **without Landlock**, bubblewrap 0.9.0): build the TUI, run its Rust suites, drive a real `zypi` under a pseudo-terminal, and look at what it leaves behind. That turned up six things, and this PR fixes them. The plan's section 10.10 has the full record (what was run, what was found, what is not verified). **What this PR is for in CI.** The numbers below were measured on WSL2, not on the runner. This PR's first TUI CI run is what confirms or corrects them: - `doctor_cmd::` is no longer skipped in `pi-pager` (12 tests). The skip existed because the voice probe hung on macOS CoreAudio; the probe is gone and the tests pass here without an audio device. If they do not hold on the runner, put the skip back (one line in `scripts/tui_baseline.toml`). - Two suites join the manifest: `pi-pager-render` (1,092 passed, 2 ignored) and `pi-pager-minimal` (79 passed). - `pi-pager` `reference_passed` 5552 -> 5577; `pi-pager-bin` 20 -> 21. - One known failure, `tmux_probe::tests::successful_near_deadline_exit_still_returns_captured_output`, is listed in `known_failures`. It spends 1.2 s of a 1.5 s budget in a shell script, so it fails when the machine stalls (twice on WSL2, both on the first run after linking, never in the 94 runs after). It is reported when it fails and does not block. **CI result.** The runs on `d84d98a` are green (TUI CI [run 38052332014](https://github.com/zy1233/pi-python/actions/runs/38052332014)): 10 suites, **8,634 passed / 0 failed / 22 ignored**, each suite equal to its `reference_passed`. That is the local 8,633 plus the one known failure, which passed on the runner, so `known_failures` stays as a safety net and was not needed this time. `doctor_cmd::` held on the runner without the skip. `cargo test` took 32 m 40 s, `Gates + cargo check` 8 m 21 s, Ruff 8 s, pytest on 3.11 / 3.12 / 3.13 about 2 minutes each; the release build baseline is skipped by design. ## The six findings | # | What was wrong | Fix | |---|---|---| | 1 | `zypi -p` runs the Python agent as a plain child on the user's terminal, so the agent never sees EOF when only zypi is killed (`kill -9`, `kill <pid>`, an IDE's stop button). The agent and a `sleep 300` it had started kept running. | zypi names itself in `PI_AGENT_PARENT_PID`; `pi_agent_cli` polls `os.getppid()` every 0.5 s in `-p` mode and stops as it does on SIGTERM (cancel the turn, reap every tool's process group). `-p` also stops on SIGTERM / SIGHUP now (exit status 128 + signal). | | 1b | With `--sandbox`, zypi re-executes itself under bubblewrap, and a plain bwrap only waits for its child. SIGKILL / SIGTERM / SIGHUP to bwrap alone left zypi, the agent and its tools running. | `bwrap --die-with-parent`, as its own commit. | | 2 | `SandboxManager::apply()` degrades on purpose (no Landlock, or applying fails): it logs, returns `Ok`, and the run goes on with none of the profile's limits. The user was never told. | The reason is kept; a warning is printed on stderr at start-up, and the welcome bar and status bar show `sandbox:<profile> (not enforced)` in the error colour. | | 3 | The agent's stderr went to `/dev/null` once the TUI was up, so a Python traceback went nowhere. | `<home>/logs/agent.stderr.log`: appended, one marker line per spawn, `0600`, rotated at 1 MiB at spawn, and a log that cannot be opened does not stop the agent. `-p` keeps the terminal. | | 4 | Two tests failed intermittently on WSL2. | Test-only: a 25 ms gap between two writes (the 100 Hz kernel clock makes ctime coarse), and `theme_cache::test_lock()` in a test that raced the terminal-native tests. | | 5 | The manifest skipped `doctor_cmd::` and had no `pi-pager-render` / `pi-pager-minimal`. | See the CI section above. | | 6 | The Linux-only checks (what is left running after each way of leaving zypi, the sandbox label, `-p` shutdown) had no repeatable form. | `scripts/tui_pty/` drives a built `zypi` under a pty (a `pyte` screen reads what it draws) and inspects the process tree. They need a built binary, so they are **not** part of pytest or CI. | ## Decision for you **`--die-with-parent` has a cost.** The sandboxed child is SIGKILLed when bwrap dies, so when only the outer bwrap gets SIGTERM or SIGHUP, zypi cannot restore the terminal (alternate screen, raw mode). Before the flag, the whole tree stayed up instead. I judged an unrestorable terminal better than a running agent nobody can see, but it is a trade, and the commit is only the flag and its test, so it is easy to revert. If you revert it, the CHANGELOG line and the plan's section 10.10 need the same edit. ## Not verified - **Landlock itself.** It needs kernel 5.13 or later and the WSL2 kernel is 5.10, so the "applied" side of the sandbox is covered by unit tests only (applying it would confine the test process for good). - **`-p` with a wrapper script as `PI_AGENT_COMMAND`.** The watch stays off when the process that started the agent is not the one named, so killing only zypi still leaves that agent behind. Windows has no counterpart for the watch. - Section 10.10 of the plan lists the rest. ## Review guide Nine commits. The first is not part of the Linux work: it was on local `main` and never pushed, so it rides along. If you squash-merge, it goes in under this PR's title; a rebase-merge keeps the nine as they are. | Commit | What | |---|---| | `eafc578` | Not mine: phase7 fix (project-trust for saved workflows, a bad meta description no longer breaks the session) | | `c13f7cc` | Finding 1: `-p` parent watch (Rust passes the pid; 15 pytest cases, POSIX only; 1 Rust test) | | `d14e6f8` | Finding 1b: `--die-with-parent` and the test that pins its position before `--` | | `2d499ad` | Finding 2: not-enforced notice (`pi-sandbox`, `pi-shell`, two render sites; 5 tests) | | `91b5f62` | Finding 3: agent stderr log (6 tests) | | `9489975` | Finding 4: two flaky tests, no production code | | `478aa8a` | Finding 5: manifest | | `15d2d85` | Finding 6: `scripts/tui_pty/` and `scripts/tests/test_tui_pty.py` | | `4cf989f` | Docs: plan 10.10 and r8, `docs/baselines/tui.md`, CHANGELOG, AGENTS files | ## Verification On WSL2, the whole manifest (`python scripts/tui_baseline.py test`): exit 0, 10 suites, 8,633 passed, 1 known failure, 22 ignored. pytest: 2,160 passed / 30 skipped on Linux (WSL), 2,156 passed / 34 skipped on Windows. `ruff check` and `ruff format --check` are clean. With a built `zypi` under a pty: `smoke.py` 23 checks (26 with `--sandbox workspace`), `exit_matrix.py` 12/12 (14/14 with the sandbox), `print_exit.py` 4/4 (the tool survived before the `-p` fix).
zy1233
added a commit
that referenced
this pull request
Oct 10, 2026
…ds the merge order The ADR1 PR 1 branch and the mode_a branch were local when the plan and the baseline report were written, and said "not pushed" in eight places. They are pushed now: #11 (codex/adr1-pr1-python) on top of #10, #12 (codex/phase1-mode-a) on top of #11. Those places name the PRs instead; the r9 statements that were true when they were written stay, as the r10 entry already says. The r10 entry in the revision log gets the last step. The user asked to sync main to origin and merge the processed PRs. The stack has four (#9, #10, #11, #12), and the upper ones have nothing to merge into until the lower ones are in, so all four are merged, bottom-up, one squash each (the convention of #7 and #8), with the base moved to main before each merge and the tree of main compared with the branch's afterwards. Local main is 9 commits ahead of origin/main; all of them except one older docs commit (superseded by the revised one in #9) are already in #9's branch, so main is not pushed: after the merges it is reset to origin/main, and the old main stays on a backup branch. Docs only: the plan, docs/baselines/tui.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Renames the user-visible "Grok" leftovers in the TUI to zypi and fixes the hints that pointed at things that do not exist. #7 is merged (squash commit
455527c); this branch is rebased onto it withgit rebase --onto, so only this PR's own commits are left, and the PR targetsmain.Decision for you. You asked for the branding cleanup but did not pick a new name, so this uses
zypi, which the product already goes by (brand.rs, terminal title, hero banner,--help). To use another name, change the constants inbrand.rsand the two theme ids (zypinight,zypiday).Three of the changes are bug fixes, not renames:
zypi doctor fix ssh-wrapinstalled a broken alias. It wrotealias ssh='grok wrap ssh'into the user's shell rc. There is nogrokcommand, sosshstopped working. It now writesalias ssh='zypi wrap ssh', inside a block marked# >>> zypi doctor >>>. Anyone who ran the old fix has to delete the old# >>> grok doctor >>>block by hand; the new version does not recognise it.~/.grok/$GROK_HOME(settings footer, the backup path in the copy toast, doctor notes) while the home is~/.pi-python/$PI_HOME. Users were sent to files that do not exist./doctor,/minimal,/fullscreenor/copyslash command, and nogrok wraporgrok worktree gc|rm|db rebuild. The hints now name what is there:zypi doctor,zypi wrap ssh <host>,--minimal/--fullscreen.zypi dudrops its worktree hints./theme, settingsGrok Night/Grok Day, idsgroknight/grokdayzypi Night/zypi Day, idszypinight/zypiday. The old ids and aliases (groknight,grok-night,GrokNight,grokday,grok-day,dark,light,day) still resolve and show the renamed theme as selected, so existingconfig.tomlfiles keep workingGrokzypizypi doctorGrok Doctor, pointers to/doctorzypi Doctor, real commands--minimal/--fullscreen,zypi doctor, no STT brand--minimalmodeGrok Build, "Sign in to Grok", trust prompt "Grok Build may run or modify…"zypigrok wrap:error prefixzypiOne change is not about branding.
bafc15efixes a Python bug thatmainnewly exposed: on macOS a project'sAGENTS.mdreached the prompt twice.AGENTS.mdandAGENTS.MDare both looked for, they name one file on a case-insensitive file system, the repeat check compared path strings, andPath.resolvekeeps the spelling it was given on macOS. Repeats are now skipped by file identity (device and inode), which also covers hard links. The new test fails without the fix, together withmain'stest_context_files_are_loaded_whatever_the_trust. You asked for it to go in with this PR.Left alone on purpose
GROK_*environment variables (GROK_HOMEalone is referenced 241 times;GROK_SANDBOXstill shows in--help), the project path.grok/sandbox.toml, and thegrok_homefield ofzypi du --json(machine readable; renaming it needs a schema decision). Renaming them breaks existing setups, so it is your call.ThemeKind::GrokNight/GrokDay,theme/groknight.rs/grokday.rs,assets/grok-night.tmTheme/grok-day.tmTheme, thegrok_*function and field names (default_grok_home,display_user_grok_path),x-grok-*HTTP headers, and thexai_grok_pager__*.snapsnapshot file names.SuperGrokbilling (app/dispatch/billing.rs), the tutorial (views/tutorial.rs), the privacy banner (views/privacy_banner.rs),pi-update(grok update,version_policy.rs), thegrok loginhints inpi-auth/pi-shell/pi-workspace, the model-facing parameter text inpi-tools(for example the workflow tool's~/.grok/workflows/), and the ACP auth method labelled "Grok".tui/crates/codegen/pi-pager/docs/user-guide/06-theming.md, Stage C.2) still listsGrokNight/GrokDay. Those names remain valid aliases, so the guide is stale rather than wrong.Review guide
Eleven commits: six Rust commits that each carry their own tests (they touch only the strings and tests they name; nothing is reformatted), one Python fix, four docs commits.
462ba3a~/.pi-python/$PI_HOME) and the copy toastsc67d681ab7e7a6zypi doctortext, fix commands and the ssh-wrap alias, startup / SSH tips01e91660bc0e80zypi duhints1c56352--minimal, startup failure, voice, status line,zypi wrapstringsbafc15eAGENTS.mdtwice on macOS), with a test9332506,4528bed,484d4e1,0d6867bmaininto #7, theAGENTS.mdfix, how the squash merges were done). Docs only;TUI CIruns again anyway because the PR as a whole touchestui/**Verification
cargo check -p pi-pager-render -p pi-pager -p pi-pager-minimal --all-targetshas 0 errors and 0 warnings; the debugzypibuild has 0 warnings.--test-threads=2, relevant filters only):pi-pager-rendertheme / util / clipboard 265 passed;pi-pager-minimal79;pi-pager --libtheme / settings / doctor / diagnostics / disk_usage / notifications / startup / tips / wrap / status_line 1,068;settings_e2e251;grok_home_paths2;doctor_early_dispatch(real binary,--ignored) 13, including the one that writes the rc alias.grok; the home label names the real directory; fix commands and the alias usebrand::CLI_NAME;DOCTOR_ACTIONcarries no slash; copy toasts, settings text and clipboard fixes name nogrokand no missing slash command;zypi dusuggests noworktree gc|rmordb rebuild.zypiagainst the agent withPI_USE_MOCK=1, no network): fullscreen welcome, slash dropdown,/help,/theme,/settings(walked 160 rows plusG, 16 distinct screens),/model, a turn,/resume, the Ctrl+C hint;--minimalwelcome,/help, a turn. Lines containinggrokor a missing slash command: 0. Withtheme = "grokday"inconfig.toml,/thememarkszypidayas active. The settings footer reads~/.pi-python/config.tomlfor the default home and$PI_HOME/config.tomlwhenPI_HOMEpoints elsewhere.--helpof the top level and of every subcommand (completions,doctor,doctor fix,du,export,help,version,wrap), plus the output ofzypi doctor,zypi duandzypi version: the only hit is[env: GROK_SANDBOX=]in the top-level--help(an env var name, kept).context_files.py);ruff checkandruff format --checkpass. Fullpyteston macOS: 2,001 passed, 5 failed. The 5 fail the same way onmainand are macOS-only (4 workflow-sandbox tests, 1 non-UTF-8 file name); Linux CI runs them green. Mutation check: without the fix, the new test andmain'stest_context_files_are_loaded_whatever_the_trustfail.0d6867b(rebased ontomainat455527c):TUI CIrun 37488552588: dependency graph 980 packages (ceiling 980), 0 warnings,cargo check --workspace --testspasses, the 8 suites pass 7,444 / 0 failed / 20 ignored (the same as before the rebase, as the Rust tree is identical);CIrun 37488553959 (Ruff, pytest on Python 3.11 / 3.12 / 3.13), which runs the new context-file test and the tests that fail on macOS.mainis green at455527ctoo:TUI CIrun 37487963487,CIrun 37487963598. The macOS-flaky test below passes on Linux.Not verified
pi-pager-renderandpi-pager-minimal. TheTUI CIsuites (scripts/tui_baseline.toml) do not include those two crates, so Linux only compiled them (cargo check --workspace --tests). The theme alias, home label, clipboard toast and--minimaltests ran on macOS only. Adding the two crates to the baseline is a small change, but it needs reference counts measured on Linux and changes the CI gate (enforce = true), so I left it for you to decide.session_startup::tests::remote_miss_restore_code_with_worktree_defersfail on macOS: it reads the real~/.pi-python/sessions/<temp repo path>(/varvs/private/var) and errors when that directory is missing. It is unrelated to this change and passed in later runs.rustfmtwas not run over whole crates (the toolchain differs from CI's and would reformat untouched files); the hunks this PR adds are formatted, checked against the diff only.