Skip to content

fix(pip): stop doubling the tool name in pip messages - #4053

Merged
KuSh merged 4 commits into
rtk-ai:developfrom
obrienciaran:fix/pip-doubled-tool-name-4050
Sep 28, 2026
Merged

KuSh merged 4 commits into
rtk-ai:developfrom
obrienciaran:fix/pip-doubled-tool-name-4050

Conversation

@obrienciaran

Copy link
Copy Markdown
Contributor

Summary

  • rtk pip ... error and verbose messages printed pip pip list because the format strings were written for the uv pip branch and reused on the plain-pip path.
  • Adds a prog_label() helper ("uv pip" or "pip") and uses it in all six affected strings in src/cmds/python/pip_cmd.rs. The executed argument was correct; only the message was wrong. This is just a costmetic fix.
  • Fixes pip error messages say "pip pip" (tool name doubled) #4050

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test

    • clean, 0 clippy warnings; new unit test test_prog_label_never_doubles_pip
  • Manual testing:

    • with a pip on PATH that can't start, rtk -v pip list / pip outdated / pip install now print
      • Running: pip list --format=json and Failed to run pip list: ... (was pip pip list).
    • With only uv on PATH, output is unchanged:
      • Running: uv pip list --format=json.

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

@CLAassistant

CLAassistant commented Sep 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working good first issue Good for newcomers pip labels Sep 14, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes a cosmetic bug in rtk pip where error and verbose messages printed 'pip pip list' instead of 'pip list' because format strings written for the 'uv pip' branch were reused on the plain-pip path. Adds a prog_label() helper that returns 'uv pip' or 'pip' and uses it consistently across all six affected message strings, with a new unit test covering both cases.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4050


Analyzed automatically by wshm · This is an automated analysis, not a human review.

`format!("Failed to run {} pip list", base_cmd)` was written for the
`uv pip` branch, so on the plain-pip path it printed "pip pip list".
Add `prog_label()` returning "uv pip" or "pip" and use it in all six
verbose/error strings. The executed argv was already correct.

Fixes rtk-ai#4050
@obrienciaran
obrienciaran force-pushed the fix/pip-doubled-tool-name-4050 branch from 3e2e4bb to 7520531 Compare September 15, 2026 08:37

@Protocol-zero-0 Protocol-zero-0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked this locally. base_cmd can only be "pip" or "uv" (line 28), so prog_label covers every case, and no "{} pip" strings are left in the file. On the uv fallback the verbose line is now right:

pip not found — falling back to `uv pip`
Running: uv pip list --format=json

The same label problem, in reverse, is still in the timer.track call a few lines up (run, ~line 50):

timer.track(
    &format!("{} {}", base_cmd, args.join(" ")),
    &format!("rtk {} {}", base_cmd, args.join(" ")),
    ...

On the plain path that records pip list / rtk pip list, which is fine. On the uv path it records a command that never ran. With a stub uv on PATH and no pip, rtk pip list leaves this row in the tracking DB:

('uv list', 'rtk uv list')

What actually ran was uv pip list, and what the user typed was rtk pip list, so rtk gain --history shows a uv list entry that doesn't correspond to either. Using the helper there too would line it up:

&format!("{} {}", prog_label(base_cmd), args.join(" ")),   // "uv pip list"
&format!("rtk pip {}", args.join(" ")),                     // what the user ran

Up to you whether that belongs in this PR or a follow-up, since it's the same "wrong tool name in a label" class.

Overlap: your #4055 also edits src/cmds/python/pip_cmd.rs, and a trial merge of the two branches conflicts, so one will need a rebase after the other lands.

The uv-fallback path recorded 'uv list' / 'rtk uv list' in the
tracking DB — a command that never ran and an invocation the user
never typed. Same doubled/wrong-label bug class as rtk-ai#4050, spotted
in PR rtk-ai#4053 review by reaching for base_cmd directly instead of
prog_label().

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@obrienciaran

obrienciaran commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@Protocol-zero-0 Thanks for reviewing it. I admit, it took me a moment to follow this explanation 😅 I get it now. Good catch. We can use prog_label() there too, and this reversed problem will also be fixed.

I'm aware of the merge conflict. If you check my comment on #4055 I mentioned it. Once this PR is merged, I will rebase #4055

Thanks!

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 2 of 3 — APPROVED, follow-ups filed

Claim: rtk pip … messages and tracking labels name the program that actually ran (pip … or uv pip …) instead of pip pip … / uv list.
Scope: accept (round 1 was a COMMENTED review with no blocking set; the tracking-label extension it asked for is in 05320b98).
Ran: pip 26.1.2 on a 389-package env × 16 rows (list, list --path <empty>, outdated --path <empty>, show pip, show <missing>, --version, no args; a pip on PATH that cannot start × list/outdated/install/quiet; uv-only PATH × list/outdated/show, with a stub uv that logs argv; no pip and no uv) × merge-base 5e0f92cd / head 05320b98; real uv 0.12.19 with pip absent (Docker, LC_ALL=C) × list/show on both binaries; rtk rewrite on 9 pip/uv spellings. Invariants: non-default targets (--path, extra args), under the hook (every row run as rtk pip …, the form the hook returns), split streams (stdout/stderr/exit captured per row), every decision (pip present / pip broken / uv only / neither). Exit codes match raw pip on all 16 rows. Savings 62% on pip list bytes (13532 → 5110; 71% by tracked tokens) vs the 20% floor (CONTRIBUTING.md). Gate: fmt, clippy, cargo test --all green on the head and on the head merged onto develop @45b0b4c3; mutating prog_label to "pip pip"/"uv" fails test_prog_label_never_doubles_pip.
Matrix: executed this round.
CI @05320b98: all green (run 36004437503, 10/10 jobs)

Blocks merge (0)

None.

Optional — will not hold merge

  • The Running: line on list/outdated still omits the user's extra args (rtk -v pip list --user prints Running: pip list --format=json), and rtk pip with no args prints Running: pip with a trailing space. Both are unchanged from develop, cosmetic, and not what #4050 reports; leaving them.

Filed as follow-ups

  • #4315 uv pip <sub> is rewritten to rtk pip <sub>, which runs plain pip whenever pip is on PATH — pre-existing (src/discover/rules.rs rewrite_prefixes + the routing in run()), outside this PR's hunks; filed as one row of #4315 (prefix-stripped rewrites: path, runner and alias prefixes; absorbs #1053, #3846, #3413 and others).
  • #4316 categorize_command has no uv arm, so rtk uv … rows land in other in the ecosystem mix — pre-existing in src/core/tracking.rs, outside this PR's hunks; filed.

Checked and correct — no need to re-verify

  • The label matches argv on every path: with a stub uv logging its argv, rtk -v pip list prints Running: uv pip list --format=json and the stub received pip list --format=json; with a broken pip, rtk pip list fails with Failed to run pip list: … (was pip pip list), exit 1 on both binaries.
  • Tracking rows on the uv path are now uv pip list / rtk pip list (were uv list / rtk uv list, a command that never ran); the pip-path rows are byte-identical before and after. rtk gain --history shows rtk pip list for both paths.
  • No sibling builds the same label: grep '{} pip\|pip {}\|"uv pip' across src/ hits only this file and the uv pip rewrite prefix.
  • Real uv with pip absent gives identical stdout/stderr/exit on the two binaries for list and show.
  • The trial merge with #4055 still conflicts in this file; as agreed, #4055 rebases after this lands.

Your questions

  • "Up to you whether that belongs in this PR or a follow-up" (round 1, on the timer.track labels) → folded in by the author in 05320b98; verified above.

Next

Nothing — approving.
Rounds: 2/3. Threads: 0 open, 0 resolved this round (round 1 posted no line threads).

@KuSh
KuSh merged commit 720d276 into rtk-ai:develop Sep 28, 2026
11 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Sep 28, 2026
@obrienciaran
obrienciaran deleted the fix/pip-doubled-tool-name-4050 branch September 28, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers pip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pip error messages say "pip pip" (tool name doubled)

4 participants