Skip to content

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented Nov 10, 2025

Previously, launching an unelevated session after an elevated one would delete the latter's persisted buffers, and vice versa of course. Also, elevated buffers didn't have an ACL forbidding access to unelevated users. That's also fixed now.

Closes #19526

Validation Steps Performed

  • Unelevated/elevated WT doesn't erase each other's buffers ✅
  • Old buffers named buffer_ are renamed to elevated_ if needed ✅

@github-actions

This comment has been minimized.

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

There's a few changes I'm confused about:

  • Package-Dev.appxmanifest
  • common.build.pre.props

I also think we want to keep the distinction between PersistLayout and PersistAll for #19341. May be worth testing persistence with both values, to be safe.

Comment on lines -1104 to +1149
sessionIds.emplace(terminalArgs.SessionId());
control.PersistTo(reinterpret_cast<int64_t>(file.get()));
bufferFilenames.emplace(std::move(filename));
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we only do this if _app.Logic().Settings().GlobalSettings().FirstWindowPreference() == FirstWindowPreference::PersistedLayoutAndContent?

Copy link
Member Author

Choose a reason for hiding this comment

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

Above, I initialize the persistBuffers variable with exactly that. This entire block of code is skipped if it's false.

MovePane,
PersistLayout,
PersistAll
Persist,
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want to keep the distinction between PersistLayout and PersistAll? See #19341

Copy link
Member Author

Choose a reason for hiding this comment

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

Not anymore. Now, this code doesn't persist the content anymore, so any Persist will be a PersistLayout.

}
break;
}
case BuildStartupKind::PersistLayout:
Copy link
Member

Choose a reason for hiding this comment

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

Seems like we'd want to keep the branches separate

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm you're right that what used to be PersistLayout, now also gets assigned a SessionId. I wonder if that's a problem... It does cause our app to try and load the corresponding buffer_{guid}.txt file, which doesn't exist (because contents didn't get persisted), but that will just silently fail. I'm not 100% sure how big of a deal this is. It's nice that we have 1 enum less IMO.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 10, 2025
@carlos-zamora carlos-zamora merged commit 81cdb07 into main Nov 20, 2025
19 checks passed
@carlos-zamora carlos-zamora deleted the dev/lhecker/19526-elevated-buffers branch November 20, 2025 19:49
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.

Elevated and unelevated terminal windows prune eachothers' session states

3 participants