Skip to content

fix(tui): single seam for conversation-scoped state on swap - #572

Merged
emal-avala merged 1 commit into
mainfrom
fix/conversation-reset-seam
Jul 29, 2026
Merged

fix(tui): single seam for conversation-scoped state on swap#572
emal-avala merged 1 commit into
mainfrom
fix/conversation-reset-seam

Conversation

@emal-avala

Copy link
Copy Markdown
Member

Summary

  • Add App::reset_conversation_scoped_state as the single list of conversation-owned state.
  • new_conversation / resume adopt use it; drops subagent rows and pending task-output reads.
  • show_task_output_for_epoch refuses stale reads after a swap.

Fixes #539.

Test plan

  • reset_conversation_scoped_state_drops_subagent_rows_and_pending_output
  • CI green

Partial clears across /clear, /resume, and task sync left manager-backed
subagent rows and in-flight task-output reads attached to the restored
session. Centralise the reset in reset_conversation_scoped_state (epoch,
todos, staged media, subagent rows, pending task reads) and epoch-gate
show_task_output.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17585da8a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2717 to +2718
self.tasks
.retain(|t| t.source != super::tasks::TaskSource::Subagent);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve task state when rewrite commands make no change

When a history-rewriting command fails or is a no-op—such as /resume <missing-id>, a disabled/invalid /snip, or /rewind with unusable arguments—the command handlers leave the engine messages unchanged, but run.rs still calls new_conversation() solely from slash_rewrites_conversation(&slash). This new retention filter then permanently removes completed subagent rows and their captured output, while the same reset also cancels any pending drill-in, even though the user remains in the original conversation; gate this reset on whether the command actually changed the history.

Useful? React with 👍 / 👎.

@emal-avala

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17585da8a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2717 to +2718
self.tasks
.retain(|t| t.source != super::tasks::TaskSource::Subagent);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep manager-backed agents eligible for polling

When a bare /clear runs while idle and the only live TaskManager job is a LocalAgent, this filter removes the sole row that makes has_live_manager_tasks() true. The tasks_tick arm in run.rs is guarded by live || app.has_live_manager_tasks(), so the claimed re-entry through sync_background_tasks never occurs until unrelated work starts another turn; the running agent and its drill-in disappear from the pane. Preserve a poll trigger or perform an immediate manager sync after this reset.

Useful? React with 👍 / 👎.

Comment on lines +2717 to +2718
self.tasks
.retain(|t| t.source != super::tasks::TaskSource::Subagent);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clamp the task selection after filtering rows

When /clear, /rewind, or /snip removes subagent rows while background rows remain, tasks_selected retains its old positional index. If the selected row moved or was removed, the renderer shows no selection and Enter is a no-op because drill_into_selected_task indexes with that stale value; resume avoids this only because adopt_restored_todos explicitly resets the index. Preserve the selected task or clamp the index as part of this reset.

Useful? React with 👍 / 👎.

@emal-avala
emal-avala merged commit 90d9799 into main Jul 29, 2026
15 checks passed
@emal-avala
emal-avala deleted the fix/conversation-reset-seam branch July 29, 2026 07:47
@emal-avala emal-avala mentioned this pull request Jul 29, 2026
7 tasks
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.

Conversation-scoped state has no single reset seam

1 participant