Skip to content

feat(tui): show context used in plan implementation prompt#18573

Merged
fcoury-oai merged 3 commits intomainfrom
feat/add-context-size-to-implement
Apr 19, 2026
Merged

feat(tui): show context used in plan implementation prompt#18573
fcoury-oai merged 3 commits intomainfrom
feat/add-context-size-to-implement

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented Apr 19, 2026

Summary

When a user finishes planning, the TUI asks whether to implement in the current conversation or start fresh with the approved plan. The clear-context choice is easier to evaluate when the prompt shows how much context has already been used, because the user can see when carrying the full prior conversation is likely to be less useful than preserving only the plan.

image

This PR adds that context signal directly to the clear-context option while keeping the copy compact enough for the Plan-mode selection popup.

What Changed

  • Compute an optional context-usage label when opening the plan implementation prompt.
  • Show the label only on Yes, clear context and implement, where it informs the cleanup decision.
  • Prefer a percentage-used label when context-window information is available, with a compact token-used fallback when only token totals are known.
  • Preserve the original option description when usage is unknown or effectively zero.
  • Add rustdoc comments around the prompt-copy boundary so future changes keep the context label formatting and selection rendering responsibilities clear.

Testing

  • cargo test -p codex-tui plan_implementation

Notes

The footer continues to show context remaining as ambient status. The implementation prompt intentionally shows context used because the user is choosing whether to clean up the current thread before implementation.

Show context usage on the clear-context implementation option so
users can see why starting fresh may help. Keep the prompt scoped to
Plan mode and display used context instead of remaining context.
Explain why the plan implementation prompt reports context used while
ambient footer status continues to report context remaining. Document
that the popup builder only owns display copy, not token accounting.
Add parameter comments to the plan implementation context usage test so
anonymous numeric literals satisfy the argument comment lint.
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

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

Looks good.

@fcoury-oai fcoury-oai merged commit 241136b into main Apr 19, 2026
25 checks passed
@fcoury-oai fcoury-oai deleted the feat/add-context-size-to-implement branch April 19, 2026 17:02
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2026
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.

2 participants