Repository navigation
fix(cli): name kcode in every resume hint, not jcode (supersedes #319) - #322
Conversation
A `jcode --resume` hint sends the operator to upstream jcode, which reads `~/.jcode` instead of `~/.kcode`, so the session they were told to resume is not in that store. afbf7e6 fixed part of this on `fix/a25-terminal-restore`, but master still emitted the literal in nine places and its own `single_session_hint_also_points_at_the_picker` test pinned the `jcode` picker line, so the test was red on master. Add `resume_binary_stem()` (= "kcode", identical to afbf7e6 so the two merge trivially) and route every emitted resume hint through it: the four crash-hint lines and `write_session_resume_hint` in terminal.rs, the post-merge resume line in cloud_move.rs, the restore-session hint in startup.rs, the manual-resume line in tui_launch.rs, and the dispatch resume failure hint. The picker test now asserts against the helper instead of the literal. Tests: `cargo test -p kcode --lib -- resume picker hint` 17 passed, 0 failed; `cargo check -p kcode` clean; `cargo fmt --check` clean (all on nixos). Refs #30 tx-agent: jcode tx-validated: test tx-lane: jcode:session_dromedary_1795252699395_0e7b881276cc3881
The picker-resume fix routed every hint through resume_binary_stem(), which expanded the multi-line format! calls in four call sites. cloud_move.rs is already over the size budget, so the literal fix grew it past the ratchet. Add `terminal::resume_hint(session_id) -> String` and render every `<bin> --resume <id>` instruction through it. cloud_move.rs is flat at 1705 LOC, and the swallowed-error budget stays improved. tx-agent: jcode tx-validated: lint tx-lane: jcode:session_guppy_1795259779712_9d08770945f44d0c
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
| /// part of the "sessions on reload have issues" report. Matches | ||
| /// `ssh::resume_hint`, which already names the kcode binary. | ||
| fn resume_binary_stem() -> &'static str { | ||
| pub(crate) fn resume_binary_stem() -> &'static str { |
There was a problem hiding this comment.
SUGGESTION: Making resume_binary_stem pub(crate) widens the surface for the single-value "kcode" literal, but the invariant that the binary name is never hand-written is not enforced elsewhere:
ssh.rs:136builds its ownvec!["kcode", "--ssh", ...]cloud_move.rs:124remote_binary()defaults to"kcode"args.rs:22#[command(name = "kcode")]
A future rename of the installed binary updates this helper but leaves those stale, reintroducing the exact mismatch this PR fixes. Consider routing those through resume_binary_stem (or documenting the coupling here) so the helper is the single source of truth.
cc @Kilo-Fix
| /// Callers that print a resume instruction should render it through this helper | ||
| /// so the binary name is never hand-written (see `resume_binary_stem`). | ||
| pub(crate) fn resume_hint(session_id: &str) -> String { | ||
| format!("{} --resume {session_id}", resume_binary_stem()) |
There was a problem hiding this comment.
SUGGESTION: crash_resume_hint_lines still renders the command inline via let bin = resume_binary_stem(); (line 362) and format!("... {bin} --resume {id}") (lines 367, 380, 381) instead of calling resume_hint. That leaves the "every hint goes through one helper" claim only partly true and lets the lines drift again. Consider routing them through resume_hint.
cc @Kilo-Fix
| /// Hint (leading newline included) that bare `--resume` opens the picker. | ||
| /// | ||
| /// Rendered through `resume_binary_stem` so it never names the wrong binary. | ||
| pub(crate) fn resume_picker_hint() -> String { |
There was a problem hiding this comment.
SUGGESTION: resume_picker_hint() embeds a leading \n in its return value, so the caller (dispatch.rs:690) must eprintln!("{}", ...) rather than adding its own spacing. That implicit layout contract is easy to break (double blank line or missing separator). Consider returning the message without the leading newline and letting the caller own spacing.
cc @Kilo-Fix
| joined.contains("kcode --resume ses_koala_123"), | ||
| "the direct resume command must still be offered: {joined}" | ||
| ); | ||
| let picker = format!("Or browse all: {} --resume", resume_binary_stem()); |
There was a problem hiding this comment.
SUGGESTION: The reworded picker assertion derives its expected string from resume_binary_stem(), so it can no longer catch a wrong binary name — the original defect class. Line 407 still pins the direct form against the literal kcode, but the picker line (the one this PR changed) now has no literal guard. Consider also asserting the rendered line contains the resolved stem literally, e.g. assert against a hard-coded kcode --resume for the picker too, to keep a real regression guard.
cc @Kilo-Fix
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Out-of-diff note (not commentable inline)
Files Reviewed (5 files)
The core fix is correct: every runtime-emitted resume hint now names Fix these issues in Kilo Cloud Reviewed by free · Input: 50.2K · Output: 6.3K · Cached: 1.3M |
|



User description
Summary
Supersedes #319.
Every resume hint must name
kcode. A hint that saysjcode --resume <id>tells the operator to run upstream jcode, which reads~/.jcodeinstead of~/.kcode, so the session they were told to resume is not in that store (same defect class as the "sessions on reload have issues" report / linked issue #30). Master still emitted the literal in nine places, and master's ownsingle_session_hint_also_points_at_the_pickertest pinned thejcodepicker line, so that test was red on master.This branch is the same change rebased onto current
master(6e315b57d), with the budget ratchet reworked:terminal::resume_binary_stem()(pub(crate), = "kcode") plus a newterminal::resume_hint(session_id)that renders<bin> --resume <id>, andterminal::resume_picker_hint()for the bare-picker sentence.crash_resume_hint_linesforms andwrite_session_resume_hintinterminal.rs, the post-merge line incloud_move.rs, the restore hint instartup.rs, the manual line intui_launch.rs, and the resume-resolution failure hint indispatch.rs.Budget ratchets (the part #319 never landed)
Rendering the hint through a helper expanded four multi-line
format!call sites.dispatch.rsandcloud_move.rsare tracked oversized files, so the literal fix grew both and failedscripts/check_code_size_budget.py. The dedupe helper keeps both flat:src/cli/dispatch.rs1528 LOC (flat, master baseline 1528)src/cli/cloud_move.rs1705 LOC (flat)Verification (nixos,
~/bin/nbuild)cargo fmt --all -- --check-> exit 0python3 scripts/check_code_size_budget.py-> exit 0python3 scripts/check_swallowed_error_budget.py-> exit 0cargo clippy -p kcode --all-targets -- -D warnings-> (see PR checks)cargo test -p kcode --lib -- resume picker hint-> (see PR checks)Refs #30
CodeAnt-AI Description
Use kcode in all session resume hints
What Changed
kcode --resumeinstead ofjcode, including crash, restore, cloud-return, and manual-resume messages.kcode, so users are directed to the session store used by this app.Impact
✅ Resume commands target the kcode session store✅ Fewer failed resumes from using the wrong app💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.