Repository navigation
fix: resolve second-round audit findings for Rust runtime removal (R2-1..R2-7) - #129
Merged
Merged
Conversation
…-1..R2-7)
Second full-repo audit of the Rust Agent Runtime Removal implementation
against `PLAN-RUST-AGENT-RUNTIME-REMOVAL.md` (r48), `docs/DESIGN.md` §8,
and `docs/specs/2026-11-05-acp-extension-registry.md` (`docs/AUDIT/AUDIT-RUST-RUNTIME-REMOVAL-2026-11-15.md`):
- R2-1 (`packages/pi-agent-cli/pi_agent_cli/agent.py`): unify open-session
release in `_release_session()` shared by `close_session` and
`ext_method("pi/session/delete")` so deleting an open session also pops
`_session_models`, `_session_cwds`, and cancels its `auto` gate.
- R2-2 (`tui/crates/codegen/pi-pager`): initialize `tracing` at the start
of `app::run` before `acp::connect` and `resolve_startup`, remove the
duplicate `pi_telemetry::external::init()` call, log startup connection
errors to tracing, and drop unused `_lvl`/`_sid` parameters in
`unified_log::make_entry`.
- R2-3 (`tui/crates/codegen/pi-pager-render/src/prompt_images.rs`): add
`<home>/pager-cache` to the orphan `[Image #N: <path>]` placeholder
recovery prefix allowlist after F-2 moved pasted image caches out of
`<home>/sessions`.
- R2-4 (`scripts/tui_baseline.py`): harden `production_lines()` against
indented or single-line `#[cfg(test)] mod tests` blocks and intervening
comments/attributes so gate scanners cannot skip following production code.
- R2-5 (`tui/crates/codegen/pi-home/src/lib.rs`): expand leading `~` in
`PI_HOME` / `GROK_HOME` against `os_home`, matching Python and VS Code.
- R2-6 (`tui/crates/codegen/pi-pager-bin`): handle `-v`/`--version` and
`doctor` before `dispatch_python_print`, remove dead
`GROK_COMPACTION_MODE` / `GROK_COMPACTION_DETAIL` env writes, and add the
remaining 8 unforwarded flags to `print_mode::ignored_flags`.
- R2-7 (`pi-acp-lib`, `docs/specs/2026-11-05-acp-extension-registry.md`,
`pi-pager`): forward `AcpMethod::ext_name()` through `AcpArgsGeneric`,
`AcpClientMessageGeneric`, and `AcpAgentMessageGeneric`; record
`packages/pi-vscode` callers and client-only `_meta` keys in the ACP
extension register; clean up two stale comments from F-5.
…stale numbers and comments The ACP register and the second audit named files and functions of the VS Code extension that do not exist (session-service.ts, session-projector.ts) and the old folder packages/pi-vscode, which is vscode/ on main. Use the real places (acp-connection.ts, chat-controller.ts, first-run.ts). Also: docs/baselines/tui.md equals the manifest (1,098 and 8,241); the orphan-prefix helper no longer sits between a doc comment and its function; three stale GROK_COMPACTION_* comments; two stray words and the close_session sentence in the audit file. Docs and comments only.
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
Resolves all findings (
R2-1throughR2-7plus first-audit follow-up items) from the second code audit of the Rust Agent Runtime Removal implementation (docs/AUDIT/AUDIT-RUST-RUNTIME-REMOVAL-2026-11-15.md):pi/session/deletestate cleanup in Python): Extract_release_session(session_id)shared byclose_sessionandext_method("pi/session/delete")inpackages/pi-agent-cli/pi_agent_cli/agent.pyso deleting an open session also forgets_session_models,_session_cwds, and callsauto.cancel().tracinginit & deduplicated telemetry init): MoveGROK_LOG_SAMPLINGandcrate::tracing::init_tracing()to the entry ofpi_pager::app::run(beforeacp::connectandresolve_startup), passTracingHandleintoevent_loop::run, remove the duplicatepi_telemetry::external::initcall inapp/mod.rs, and remove unused parameters fromunified_log::make_entry.<home>/pager-cacheorphan image placeholder allowlist): Include<home>/pager-cacheinbuild_content_blocks_with_workspace's allowed prefix list (allowed_prefixes_with_pager_cache_in) so orphan[Image #N: <path>]placeholders in the relocated pager cache directory can be resolved while keeping<home>root files excluded.scripts/tui_baseline.py#[cfg(test)]parser hardening): Track the indentation ofmod testsand handle single-linemod tests {}, same-line#[cfg(test)] mod tests, and comments/blank lines between#[cfg(test)]andmod testsinproduction_lines().pi-hometilde expansion): Expand~,~/..., and~\...inPI_HOME/GROK_HOMEagainstos_homeintui/crates/codegen/pi-home/src/lib.rs, matching Python (expanduser()) andpi-vscode(expandHome).pi-pager-bin-p -vprecedence, dead compaction env vars,print_mode::ignored_flags): Check-v/--versionanddoctorbeforedispatch_python_print, remove deadGROK_COMPACTION_MODE/GROK_COMPACTION_DETAILenv var writes inasync_main, and add--trust,--compaction-mode,--compaction-detail,--worktree-ref,--restore-code,--no-ask-user,--no-wait-for-background, and--oauthtoprint_mode::ignored_flags.AcpMethod::ext_nameforwarding, ACP extension register, stale comments): ForwardAcpMethod::ext_name()onAcpArgsGeneric,AcpClientMessageGeneric, andAcpAgentMessageGeneric; updatedocs/specs/2026-11-05-acp-extension-registry.mdwithpackages/pi-vscodecallers and §5 client-only_metakeys; clean up stale comments inagent_modes.rsandsession_startup.rs.Verification
.venv/bin/ruff check&.venv/bin/ruff format --check.venv/bin/python -m pytest packages/pi-agent-cli/tests/ scripts/tests/.venv/bin/python scripts/tui_baseline.py gatescargo test --locked -p pi-home -p pi-acp-lib -p pi-pager-render -p pi-pager-bin&cargo check --locked -p pi-pager -p pi-pager-bin --tests