Skip to content

feat(tui): poke-context command surface - #381

Closed
KooshaPari wants to merge 3 commits into
masterfrom
feature/pr-25-poke-context
Closed

KooshaPari wants to merge 3 commits into
masterfrom
feature/pr-25-poke-context

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

User description

Salvage

This branch was found during the 2026-11-27 branch-retirement pass and is
not contained in master. It is opened here so the work is reviewable and
does not silently rot as a remote ref.

Evidence it is not redundant (all three must hold; see
host-ops/kcode-branch-retirement):

  • git merge-tree --write-tree origin/master origin/feature/pr-25-poke-context produces a tree that
    differs from origin/master (so merging it changes master).
  • The branch's blobs do not all appear anywhere in origin/master's history
    of the paths it touches.
  • No open PR already covers it.

Size: 9 file(s), 9 files changed, 211 insertions(+), 16 deletions(-).

Review this as a normal contribution. It is not auto-merged, and the branch is
kept until someone decides.

Recovery/identity: the branch is feature/pr-25-poke-context at
35ebbb0c0ea2d4d4654e55719c3c0ccea65deb36.

tx-agent: jcode


CodeAnt-AI Description

Start a fresh session to recover project context with /poke

What Changed

  • /poke <repo-name> starts a fresh session to recover context for one repository; /poke and /poke all cover all active repositories.
  • The new session reviews saved memories and recent conversation, reports repository status and next steps, and pauses for approval before consequential actions.
  • /poke on, /poke off, and /poke status continue to control automatic todo follow-ups. Remote context launches retain attached images.

Impact

✅ Recover prior work without restating context
✅ Limit recovery to one or all active repositories
✅ Keep attached images when opening a remote session

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

Add /poke <subcommand> variants that let users recover context
mid-session without leaving the current TUI:

  /poke on|off|status   — enable/disable/query automatic context
                          refresh on user-input turn boundaries
                          (existing behavior, now without the bare
                          /poke trigger form)
  /poke repo-name       — stage a 'resume from <repo>' prompt and
                          launch a fresh local session with it
  /poke jcode           — stage a 'resume from jcode' prompt and
                          launch a fresh local session with it
  /poke all             — alias for repo-name
  /poke <anything-else> — falls through to the existing
                          'resume in new session' dispatcher

Implementation:
- New module commands_poke_context.rs (118 LoC) owns scope
  parsing, prompt building, and the new-session launch. Kept
  outside commands.rs so the existing handle_session_command
  surface stays under the 350-LoC decomposition target.
- commands.rs now imports the new module and delegates
  /poke <scope> before falling through to PokeCommand::On.
  The bare /poke (no scope) form is removed to avoid ambiguity
  with the new context-recovery semantics.
- commands_dispatch.rs rejects any /poke variant over SSH
  except on/off/status (the new-session launch is local-only).
- input_help.rs and state_ui_input_helpers.rs updated to
  advertise the new subcommands and the deprecated bare form.
- remote/key_handling.rs routes the new context-recovery
  command to a new remote session and preserves the
  user-attached image set across the SplitResponse.

Tests:
- Existing state_model_poke_03 and remote_events_reload_02
  tests updated to use the new /poke on form (the bare form
  is no longer accepted).
- New remote_events_reload_04::test_remote_poke_context_
  preserves_prompt_and_attached_images verifies that the
  staged prompt reaches the new session and the attached
  images are preserved through the SplitResponse cycle.

tx-agent:     jcode
tx-validated: cargo-check
tx-task:      pr-25
tx-scope:     crates/jcode-tui/src/tui/app/{commands,commands_dispatch,commands_poke_context,input_help,state_ui_input_helpers,remote/key_handling}.rs + tests
tx-intent:    surface PR #25's /poke context-recovery feature into master
Copilot AI balanced review requested due to automatic review settings November 27, 2026 09:57
@codeant-ai

codeant-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #0a952 Reviewed your PR 35ebbb0 Nov 27, 2026 · 09:57 10:05

@codeant-ai

codeant-ai Bot commented Nov 27, 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

@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: f7b19899-cabe-4db5-961c-c946f2107565
Commits

Reviewing files that changed from the base of the PR and between 787ad04 and 35ebbb0.

Files selected for processing: 9

  • crates/jcode-tui/src/tui/app/commands.rs
  • crates/jcode-tui/src/tui/app/commands_dispatch.rs
  • crates/jcode-tui/src/tui/app/commands_poke_context.rs
  • crates/jcode-tui/src/tui/app/input_help.rs
  • crates/jcode-tui/src/tui/app/remote/key_handling.rs
  • crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs
  • crates/jcode-tui/src/tui/app/tests/remote_events_reload_02/part_01.rs
  • crates/jcode-tui/src/tui/app/tests/remote_events_reload_04.rs
  • crates/jcode-tui/src/tui/app/tests/state_model_poke_03.rs
  • 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

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.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Nov 27, 2026
};
format!(
"You were started by `/poke` in a fresh Jcode session to recover the operator's active work context and continue safely. Scope: {scope}.\n\n\
First recover context before acting: read the global memory registry and its relevant entries under `~/.jcode/memories/global/`; read relevant project memories for the scoped repositories; inspect this session's recent conversation history with `conversation_search` (stats, then recent turns and relevant prior requests). Treat the latest user instruction as authoritative and preserve prior constraints.\n\n\

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Custom agent: Impeccable Design Review (Beta)

Suggestion: Direct context recovery to the supported global-memory store or memory tools instead of this directory.

Severity Level: Major ⚠️ · 🏷️ Ui

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** crates/jcode-tui/src/tui/app/commands_poke_context.rs
**Line:** 41:41
**Comment:**
	*Ui: Direct context recovery to the supported global-memory store or memory tools instead of this directory.

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
👍 | 👎

@sonarqubecloud

Copy link
Copy Markdown

RegisteredCommand::hidden("/clear-view", "Alias for /cls"),
RegisteredCommand::public("/rewind", "Rewind conversation to previous message"),
RegisteredCommand::public("/poke", "Poke model to resume with incomplete todos"),
RegisteredCommand::public("/poke", "Start a fresh session with recovered project context"),

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: The hand-written /help entry suppresses this description, so users are told bare /poke resumes todos even though it launches a fresh context session.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Comment mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs
**Line:** 135:135
**Comment:**
	*Comment Mismatch: The hand-written `/help` entry suppresses this description, so users are told bare `/poke` resumes todos even though it launches a fresh context session.

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
👍 | 👎

};
format!(
"You were started by `/poke` in a fresh Jcode session to recover the operator's active work context and continue safely. Scope: {scope}.\n\n\
First recover context before acting: read the global memory registry and its relevant entries under `~/.jcode/memories/global/`; read relevant project memories for the scoped repositories; inspect this session's recent conversation history with `conversation_search` (stats, then recent turns and relevant prior requests). Treat the latest user instruction as authoritative and preserve prior constraints.\n\n\

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: The prompt points to ~/.jcode/memories/global/, but global memories are stored in memory/global.json; following this instruction misses the registered memories.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** crates/jcode-tui/src/tui/app/commands_poke_context.rs
**Line:** 41:41
**Comment:**
	*Logic Error: The prompt points to `~/.jcode/memories/global/`, but global memories are stored in `memory/global.json`; following this instruction misses the registered memories.

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
👍 | 👎

"/poke context launch is unavailable while disconnected from the Jcode server. Reconnect and try again.".to_string(),
));
} else {
match super::launch_prompt_in_new_session_local(app, prompt, Vec::new()) {

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: When a local /poke command has attached images, this passes none to the child session, so the images are unavailable there.

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:** crates/jcode-tui/src/tui/app/commands_poke_context.rs
**Line:** 60:60
**Comment:**
	*Incomplete Implementation: When a local `/poke` command has attached images, this passes none to the child session, so the images are unavailable there.

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 27, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt PR Risk

🟡  Medium Risk

  • The PR needs attention before merging because its context-recovery prompt points to a global-memory directory that does not match the supported memory store.
  • Local /poke launches pass no attached images to the child session, so that image context is lost.

Assessed commit: 35ebbb0c0ea2

let prepared = input::PreparedInput {
raw_input: trimmed.to_string(),
expanded: prompt,
images: prepared.images,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL: Compile error — prepared.images references prepared inside its own initializer. A let binding is not in scope within its own initializer, so this fails cargo check/cargo build and blocks cargo test --workspace.

Pass the app's pending images instead (launch_prompt_in_new_session_local accepts Vec<(String, String)> and app.pending_images holds them):

Suggested change
images: prepared.images,
images: app.pending_images.clone(),

@KooshaPari

Copy link
Copy Markdown
Owner Author

Parked as a draft by the closure gate D1.5 sweep: mergeStateStatus is DIRTY, so the PR is not mergeable yet. The gate counts every open non-draft PR as owing a decision, and a draft records that decision honestly instead of leaving it ambiguous. Mark ready when the blocking condition clears.

@KooshaPari KooshaPari closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants