Skip to content

Show session resume hint with session id on CLI exit (for ctrl c + ctrl c, /exit(& /quit), and ctrl d exit paths)#2760

Merged
larsspinetta12 merged 3 commits into
mainfrom
add-session-resume-exit-message-with-session-id
Jun 5, 2026
Merged

Show session resume hint with session id on CLI exit (for ctrl c + ctrl c, /exit(& /quit), and ctrl d exit paths)#2760
larsspinetta12 merged 3 commits into
mainfrom
add-session-resume-exit-message-with-session-id

Conversation

@larsspinetta12

Copy link
Copy Markdown
Collaborator

Fixes #(custom)

Describe the changes you have made in this PR - Changed the output message for when you use exit paths(ctrl c + ctrl c, /exit, /quit, and ctrl d) to include a goodbye message and "resume using: /resume <session_id>".

Demo/Screenshot for feature changes and bug fixes -

For /quit:
image

For /exit:
image

For ctrl c + ctrl c
image

For ctrl d:
image


Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • [(\checkmark )] No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance:

  • I have reviewed every single line of the AI-generated code
  • I can explain the purpose and logic of each function/component I added
  • I have tested edge cases and understand how the code handles them
  • I have modified the AI output to follow this project's coding standards and conventions

Explain your implementation approach:


Checklist before requesting a review

  • [(\checkmark )] I have added proper PR title and linked to the issue
  • [(\checkmark )] I have performed a self-review of my code
  • [(\checkmark )] I can explain the purpose of every function, class, and logic block I added
  • [(\checkmark )] I understand why my changes work and have tested them thoroughly
  • [(\checkmark )] I have considered potential edge cases and how my code handles them
  • [(\checkmark )] If it is a core feature, I have added thorough tests
  • [(\checkmark )] My code follows the project's style guidelines and conventions

Note: Please check Allow edits from maintainers if you would like us to assist in the PR.

@larsspinetta12 larsspinetta12 self-assigned this Jun 5, 2026
@larsspinetta12 larsspinetta12 added enhancement New feature or request cli Command-line interface work labels Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Greptile code review

This repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md.

Run a review — add a PR comment with:

@greptile review

Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5.

Optional: automate with the greploop skill.

@greptile-apps

greptile-apps Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a session-resume hint to all CLI exit paths (ctrl+c double-press, /exit, /quit, and ctrl+d), showing the user Resume this session with: /resume <session_id> before the farewell message.

  • system.py: /exit and /quit now print the resume hint (guarded by if session.session_id:) before printing goodbye.
  • prompt_support.py: repl_prompt_note_ctrl_c gains a session_id parameter and prints the resume hint before Goodbye! on the second ctrl+c; the guard around the resume lines is missing, so a None session_id will render /resume None on screen
  • loop.py: The ctrl+d (EOFError) block now prints the resume hint and Goodbye!, but does so with unstyled plain strings rather than the [{DIM}] Rich markup used by every other exit path

Confidence Score: 4/5

Safe to merge once the missing session_id guard in the ctrl+c double-press path is added; without it, the terminal outputs the literal text /resume None when no session is active.

The ctrl+c exit path in prompt_support.py prints the resume line unconditionally — if session_id is None, the user sees /resume None on screen, which is misleading. Every other changed exit path wraps the resume output in a session_id check, so this one path is out of step with the rest of the change.

app/cli/support/prompt_support.py — the repl_prompt_note_ctrl_c function needs a if session_id: guard around the resume lines (lines 197-198)

Important Files Changed

Filename Overview
app/cli/interactive_shell/command_registry/system.py Adds resume hint before goodbye for /exit and /quit; session_id guard is correct, but the resume string has a trailing space before [/] that may attach to copied output
app/cli/support/prompt_support.py Adds session_id param to repl_prompt_note_ctrl_c and prints resume hint on double ctrl+c; missing if-guard means /resume None is printed when session_id is absent
app/cli/interactive_shell/runtime/loop.py Ctrl+d path gains resume hint and Goodbye! inside a session_id guard, but uses unstyled plain strings instead of the [{DIM}] Rich markup used by every other exit path

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User triggers exit] --> B{Exit path}
    B -->|/exit or /quit| C[system.py: _cmd_exit]
    B -->|Ctrl+C x 2| D[prompt_support.py: repl_prompt_note_ctrl_c]
    B -->|Ctrl+D / EOFError| E[loop.py: EOFError handler]

    C --> F{session.session_id?}
    F -->|Yes| G[print resume hint - DIM styled]
    F -->|No| H[skip resume hint]
    G --> I[print goodbye. - DIM styled]
    H --> I

    D --> J{last ctrl+c within 2s?}
    J -->|Yes| K[print resume hint - no session_id guard!]
    K --> L[print Goodbye! - DIM styled]
    J -->|No| M[print Press Ctrl+C again to exit]

    E --> N{session.session_id?}
    N -->|Yes| O[print resume hint + Goodbye! - plain text no DIM]
    N -->|No| P[silent exit]
Loading

Reviews (2): Last reviewed commit: "Update app/cli/support/prompt_support.py" | Re-trigger Greptile

Comment thread app/cli/support/prompt_support.py Outdated
Comment thread app/cli/interactive_shell/runtime/loop.py
Comment thread app/cli/support/prompt_support.py Outdated
larsspinetta12 and others added 2 commits June 5, 2026 15:45
fixes trailing space

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@larsspinetta12 larsspinetta12 merged commit 267ee5c into main Jun 5, 2026
17 checks passed
@larsspinetta12 larsspinetta12 deleted the add-session-resume-exit-message-with-session-id branch June 5, 2026 14:54
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🎯 Bullseye. @larsspinetta12 opened a PR, kept the vibes clean, and got it merged. Absolute cinema. 🎬


👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome.

@muddlebee

Copy link
Copy Markdown
Collaborator

@greptile review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Command-line interface work enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants