Skip to content

fix: session_restore: replay tracked input modes with the restore buffer - #404

Open
dob323 wants to merge 1 commit into
shell-pool:masterfrom
dob323:fix/restore-input-modes
Open

fix: session_restore: replay tracked input modes with the restore buffer#404
dob323 wants to merge 1 commit into
shell-pool:masterfrom
dob323:fix/restore-input-modes

Conversation

@dob323

@dob323 dob323 commented Aug 3, 2026

Copy link
Copy Markdown

Issue Link

(none)

AI Policy Ack

I have read the AI Policy. This patch was written with Claude Code, working from failures in my own shpool deployment. Test coverage was added during review: attach::screen_restore_input_modes, which fails without the fix.

This PR was:

  • mostly or completely vibe coded
  • mostly or completely meat coded
  • bit of both

Description

On attach, the vt100 restore paths replay screen contents
(contents_formatted / last_n_rows_contents_formatted) but never the
input modes the application enabled, although the engine already tracks
them and exposes input_mode_formatted() (application keypad/cursor,
bracketed paste, mouse protocol). A freshly connected client therefore
starts with those modes off while the application inside believes they are
on.

The visible failure is pasting into a reattached session: terminals with
paste protection prompt ("paste may be dangerous"), and the paste arrives
unbracketed so embedded newlines submit immediately. A TUI composer
receives a multi-line paste as several submitted lines.

This appends input_mode_formatted() to both vt100 restore buffers. The
simple mode and vterm engine are unchanged.

@google-cla

google-cla Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ethanpailes ethanpailes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh nice, thanks!

@ethanpailes

Copy link
Copy Markdown
Contributor

Oh, also please disclose your use of AI to generate this patch, as requested by the PR template.

@ethanpailes ethanpailes changed the title session_restore: replay tracked input modes with the restore buffer fix: session_restore: replay tracked input modes with the restore buffer Aug 3, 2026

@ethanpailes ethanpailes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just realized this needs test coverage.

@dob323
dob323 force-pushed the fix/restore-input-modes branch from 60e7e39 to 2094d7c Compare August 6, 2026 19:19
@dob323

dob323 commented Aug 6, 2026

Copy link
Copy Markdown
Author

@googlebot I signed it!

@ethanpailes

Copy link
Copy Markdown
Contributor

Could you add tests?

@ethanpailes

Copy link
Copy Markdown
Contributor

I think a new case in the attach test suite would make sense.

@dob323 dob323 closed this Aug 6, 2026
@dob323 dob323 reopened this Aug 6, 2026
@dob323
dob323 force-pushed the fix/restore-input-modes branch from 2094d7c to 2a219eb Compare August 6, 2026 19:46
Restoring only the screen contents leaves a freshly attached terminal
without the input modes the application enabled, so bracketed paste,
application cursor/keypad and mouse reporting are silently lost across a
reattach. A paste then arrives unbracketed and every newline in it
submits early.

Covered by attach::screen_restore_input_modes, which drives mouse
reporting (nothing in the shell sets it) and asserts the reattach re-arms
it.
@dob323
dob323 force-pushed the fix/restore-input-modes branch from 2a219eb to 4ebb204 Compare August 6, 2026 20:04
@dob323

dob323 commented Aug 6, 2026

Copy link
Copy Markdown
Author

Sorry, I missed your test requests from Friday. All three have tests now:

Each one fails on master and passes with its patch.

@ethanpailes ethanpailes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great, thanks!

@ethanpailes

Copy link
Copy Markdown
Contributor

I don't see the usual CI actions. I think there might be some sort of global admin change that I need to figure otu before merging.

@ethanpailes ethanpailes closed this Aug 6, 2026
@ethanpailes ethanpailes reopened this Aug 6, 2026
@ethanpailes

Copy link
Copy Markdown
Contributor

I filed a bug about these scan checks that are holding up CI. They should not be taking this long to run.

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.

2 participants