Skip to content

feat(cli): /redo resubmits the most recent user prompt#210

Merged
emal-avala merged 1 commit intomainfrom
feat/redo-command
Apr 23, 2026
Merged

feat(cli): /redo resubmits the most recent user prompt#210
emal-avala merged 1 commit intomainfrom
feat/redo-command

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds `/redo` (alias `/again`) — finds the most recent user-authored prompt in this session and resubmits it as a new turn.

When the model's answer missed the mark (wrong assumption, sloppy decomposition, you want a second roll) you can now retry without retyping. Prints a one-line preview before re-submitting so you can see exactly what's going back in.

How it picks the prompt

`last_user_prompt` walks the message history backwards and returns the first `Message::User` that:

  • is not a tool_result (`is_meta`)
  • is not a compact-summary boundary
  • has non-whitespace text content

Multi-block prompts are joined with newlines so they round-trip intact.

Test plan

  • `cargo fmt --all`
  • `cargo clippy -p agent-code --all-targets -- -D warnings`
  • `cargo test -p agent-code --bin agent` (102 passed)
  • New tests:
    • `last_user_prompt_returns_most_recent`
    • `last_user_prompt_skips_tool_results`
    • `last_user_prompt_skips_compact_summary`
    • `last_user_prompt_returns_none_for_empty_session`
    • `last_user_prompt_skips_whitespace_only`
    • `last_user_prompt_joins_multiple_text_blocks`
    • `preview_line_truncates_with_ellipsis`
    • `preview_line_collapses_whitespace`

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Tiny companion to /history. When the model's response missed the
mark — wrong assumption, bad decomposition, or you just want a
second roll — /redo grabs the last real user prompt and feeds it
back as a new turn. Aliased to /again.

Skips tool_result messages and compact summaries when finding the
most recent prompt, so what gets resubmitted is exactly what you
typed. Echoes a one-line preview so there's no ambiguity about
what's being sent.
@emal-avala emal-avala merged commit 7230563 into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/redo-command branch April 23, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant