Skip to content

fix(cli): name kcode in every resume hint, not jcode - #319

Closed
KooshaPari wants to merge 1 commit into
masterfrom
fix/picker-resume-stem
Closed

KooshaPari wants to merge 1 commit into
masterfrom
fix/picker-resume-stem

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

User description

Every resume hint must name kcode. A hint that says jcode --resume <id> tells the operator to run upstream jcode, which reads ~/.jcode instead of ~/.kcode, so the session they were told to resume is not in that store; it is the same defect class as the "sessions on reload have issues" report. Commit afbf7e658 (on fix/a25-terminal-restore) added resume_binary_stem() and fixed part of this, but master still emitted the literal in nine places, and master's own single_session_hint_also_points_at_the_picker test pinned the jcode picker line, so that test was red on master.

This PR adds the identical resume_binary_stem() -> "kcode" helper (same body as afbf7e658, so the two merge without conflict) and routes every emitted hint through it:

  • src/cli/terminal.rs - the four crash_resume_hint_lines forms (single-session resume, "Or browse all", multi-session resume, "List all") and the write_session_resume_hint fallback
  • src/cli/cloud_move.rs - the post-merge "Resume:" line
  • src/cli/startup.rs - the "To restore this session, run:" hint
  • src/cli/tui_launch.rs - the manual resume line printed when no terminal emulator is found
  • src/cli/dispatch.rs - the resume-resolution failure hint

The picker test now asserts against the helper instead of a literal, so it cannot pin the wrong binary again. Comments and doc comments that mention jcode --resume as prose were deliberately left alone.

Verification on nixos (PKG_CONFIG_PATH from nixpkgs#openssl.dev, since nbuild does not forward it):

  • cargo test -p kcode --lib -- resume picker hint -> 17 passed, 0 failed (includes the previously-red single_session_hint_also_points_at_the_picker)
  • cargo check -p kcode -> clean
  • cargo fmt --check on the five touched files -> clean

Refs #30


CodeAnt-AI Description

Show the correct command for resuming sessions

What Changed

  • Resume instructions in crash notices, startup errors, cloud returns, and session-listing messages now use kcode --resume.
  • When a session can’t be found, the guidance for listing available sessions also points to kcode.

Impact

✅ Resume commands find sessions in the kcode store
✅ Crash recovery points to the correct app
✅ Manual resume instructions work when no terminal is available

💡 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.

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
Copilot AI balanced review requested due to automatic review settings November 21, 2026 09:34
@codeant-ai

codeant-ai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #1d29d Reviewed your PR 5a26438 Nov 21, 2026 · 09:34 09:38

@codeant-ai

codeant-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Replaces the hardcoded jcode with kcode in emitted resume hints. Adds terminal::resume_binary_stem(), which returns "kcode", and routes hints in terminal.rs, cloud_move.rs, startup.rs, tui_launch.rs, and dispatch.rs through it. The picker test now asserts against the helper. Diff: 5 files, +40/−14.
Author reports cargo test -p kcode --lib -- resume picker hint passed (17 passed). Clippy and workspace test results: not available.

Resume guidance now uses resume_binary_stem(), which returns kcode, instead of hardcoding jcode in recovery and error messages.

Changes: Resume guidance

Layer / File(s) Summary
Shared executable stem and resume hints
src/cli/terminal.rs, src/cli/cloud_move.rs, src/cli/dispatch.rs, src/cli/startup.rs, src/cli/tui_launch.rs
resume_binary_stem() returns kcode. Crash-resume hints, fallback hints, and recovery and error messages use the helper. The crash-hint test expectation also uses it.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: 1jehuang

Merge Risk: Minimal · up to 5a264

Resume hints now point to the kcode binary instead of jcode, which reads a different config directory. This is a low-risk, text-only change and is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: resume hints now name kcode instead of jcode in the CLI. It is specific and matches the changeset in src/cli (terminal, cloud_move, startup, tui_launch, dispatch) that…
Description check Passed The description explains the defect: resume hints that say jcode send operators to the upstream store (~/.jcode) instead of ~/.kcode. It lists the five touched files, the new resume_binary_stem() help…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: resume hints now name kcode instead of jcode in the CLI. It is specific and matches the changeset in src/cli (terminal, cloud_move, startup, tui_launch, dispatch) that routes hints through resume_binary_stem().

Full details: Description check

Explanation

The description explains the defect: resume hints that say jcode send operators to the upstream store (~/.jcode) instead of ~/.kcode. It lists the five touched files, the new resume_binary_stem() helper, the picker test change, and the verification commands. This matches the raw summary.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: cb6fe840-a1e1-4357-91e9-7707a23203fd
Commits

Reviewing files that changed from the base of the PR and between 5f96190 and 5a26438.

Files selected for processing: 5

  • src/cli/cloud_move.rs
  • src/cli/dispatch.rs
  • src/cli/startup.rs
  • src/cli/terminal.rs
  • src/cli/tui_launch.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Recent review details

Context from checks skipped due to timeout: 9

  • GitHub Check: Windows Cross-Target Check (Linux)
  • GitHub Check: Build & Test (linux) (ubuntu-latest)
  • GitHub Check: Clippy
  • GitHub Check: TypeScript SDK
  • GitHub Check: Quality Guardrails
  • GitHub Check: Format
  • GitHub Check: Cargo Check & Parity
  • GitHub Check: Kilo Code Review
  • GitHub Check: semgrep-cloud-platform/scan

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Nov 21, 2026
Comment thread src/cli/terminal.rs
/// part of the "sessions on reload have issues" report. Matches
/// `ssh::resume_hint`, which already names the kcode binary.
pub(crate) fn resume_binary_stem() -> &'static str {
"kcode"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Single source of truth for the resume-hint binary name

ssh::resume_hint (src/cli/ssh.rs:136) still hardcodes its own "kcode" literal rather than calling this helper. Now that resume_binary_stem() exists as the canonical name used by every other resume hint, routing ssh::resume_hint through it too would prevent the two from silently drifting if the binary name ever changes. Non-blocking — this PR is correct as-is.

@kilo-code-bot

kilo-code-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Merge with notes

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1

This PR is a clean, mechanical fix: every emitted jcode --resume hint now routes through the new resume_binary_stem() -> "kcode" helper so operators are pointed at the correct binary/store. All nine emission sites are covered (four crash-hint forms, write_session_resume_hint, cloud_move resume line, startup restore hint, tui_launch manual-resume, dispatch failure hint). No emitted resume hint still hardcodes jcode; only doc comments and prose mention it, which the PR intentionally left alone. The picker test now asserts against the helper instead of a literal. No clippy/test/fmt concerns visible in the diff.

Issue Details (click to expand)

SUGGESTION

File Line Issue
src/cli/terminal.rs 328 ssh::resume_hint (src/cli/ssh.rs:136) still hardcodes its own "kcode" literal rather than calling resume_binary_stem(). Route it through the helper to avoid future drift.
Files Reviewed (5 files)
  • src/cli/cloud_move.rs - resume line uses helper; correct
  • src/cli/dispatch.rs - failure hint uses helper; correct
  • src/cli/startup.rs - restore hint uses helper; correct
  • src/cli/terminal.rs - helper added; four crash-hint forms + fallback converted; picker test de-pinned (1 suggestion)
  • src/cli/tui_launch.rs - manual resume line uses helper; correct

Fix these issues in Kilo Cloud


Reviewed by free · Input: 41.9K · Output: 5.7K · Cached: 595.7K

@sonarqubecloud

Copy link
Copy Markdown

Comment thread src/cli/startup.rs
Comment on lines +565 to +569
output::stderr_info(format!(
" {} --resume {}",
crate::cli::terminal::resume_binary_stem(),
session_id
));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: For a resumed SSH session, session_id identifies a remote session, but this prints a local-only command; kcode --resume cannot reconnect to that host.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/cli/startup.rs
**Line:** 565:569
**Comment:**
	*Incomplete Implementation: For a resumed SSH session, `session_id` identifies a remote session, but this prints a local-only command; `kcode --resume` cannot reconnect to that host.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt PR Risk

🟡  Medium Risk

  • The PR needs attention because error recovery may print a local resume command for a session hosted over SSH.
  • In startup.rs, report_main_error uses the session ID without checking whether the SSH-specific resume command is needed.

Assessed commit: 5a2643858506

@KooshaPari

Copy link
Copy Markdown
Owner Author

Superseded by #322, which carries this same change rebased onto current master (6e315b5) and adds the size-budget dedupe helper that keeps dispatch.rs and cloud_move.rs flat. Closing this PR: its head (5a26438) sits on pre-realign history and there is no non-destructive way to move it.

@KooshaPari KooshaPari closed this Nov 21, 2026
KooshaPari added a commit that referenced this pull request Nov 21, 2026
#322)

* fix(cli): name kcode in every resume hint, not jcode

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

* refactor(cli): extract resume_hint helper to keep budgets green

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants