Skip to content

fix: /clear now clears terminal screen and resets context left indicator - #425

Merged
tibo-openai merged 12 commits into
openai:mainfrom
nerdielol:nerdielol/issue395
Apr 21, 2025
Merged

tibo-openai merged 12 commits into
openai:mainfrom
nerdielol:nerdielol/issue395

Conversation

@nerdielol

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Implements the full /clear command in codex‑cli:
    • Resets chat history and wipes the terminal screen.
    • Shows a single system message: Context cleared.
  • Adds comprehensive unit tests for the new behaviour.

Why is it needed?

How is it implemented?

  • Code – Adds process.stdout.write('\x1b[3J\x1b[H\x1b[2J') in terminal.tsx. Removed reference to prev in setItems((prev) => [ ...prev, in terminal-chat-new-input.tsx & terminal-chat-input.tsx.

CI / QA

All commands pass locally:

pnpm test      # green
pnpm run lint  # green
pnpm run typecheck  # zero TS errors

Results

Screen.Recording.2025-04-19.at.3.22.27.PM.mov

@github-actions

github-actions Bot commented Apr 19, 2025 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@nerdielol

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 19, 2025
@nerdielol nerdielol changed the title fix: /clear now clear terminal screen and resets context left indicator fix: /clear now clears terminal screen and resets context left indicator Apr 19, 2025
@fouad-openai
fouad-openai self-requested a review April 19, 2025 23:11
@fouad-openai fouad-openai changed the title fix: /clear now clears terminal screen and resets context left indicator fix: /clear now clears terminal screen and resets context left indicator Apr 19, 2025
@fouad-openai

Copy link
Copy Markdown
Contributor

thanks @nerdielol - looks like it just needs formatting fix, then should be good!

@nerdielol

Copy link
Copy Markdown
Contributor Author

thanks @nerdielol - looks like it just needs formatting fix, then should be good!

@fouad-openai

  1. Branch updated
  2. Formatting fix
Screenshot 2025-04-19 at 11 56 23 PM

@tibo-openai

Copy link
Copy Markdown
Collaborator

Fixed some merge conflicts and ensured that we preserve the developer message when clearing, we should only remove user and assistant turns.

@tibo-openai

Copy link
Copy Markdown
Collaborator

@nerdielol there are some test issues that are related to the terminal clearing implemented here, could you take a look? Will be excited to merge this once they are, thanks!

@nerdielol

nerdielol commented Apr 21, 2025 •

Copy link
Copy Markdown
Contributor Author

@tibo-openai ready for review.

Note: I discovered several new bugs and fixed.

  1. function_call and function_call_output must be cleared to allow context left indicator to reset.
  2. system message "Terminal Cleared" not displayed on first /clear attempt (UI update issue).

Results:
Screenshot 2025-04-21 at 2 17 49 AM

@tibo-openai

Copy link
Copy Markdown
Collaborator

Merging, ty for the nice contribution!

@tibo-openai
tibo-openai merged commit 797eba4 into openai:main Apr 21, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 2025
@nerdielol
nerdielol deleted the nerdielol/issue395 branch April 21, 2025 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants