Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(agent/reconnectingpty): allow selecting backend type#17011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 2 commits intomainfromcj/reconnectingpty-backend
Mar 20, 2025

Conversation

johnstcn
Copy link
Member

In#8640 we added an alternative 'screen' backend for our reconnectingpty endpoint used by our web terminal.
This opportunistically checks for the presence ofscreen in$PATH and selects the screen backend if screen is available, falling back to the default "buffered" backend.

This is fantastic for long-lived shell sessions, but another use case for rpty is just executing "one-off" commands (basically, anything that isn't a shell).
In these cases, the screen backend is actually kind of annoying, as you get the following output:

<output of command>[screen is terminating]

I considered the alternative of stripping the extraneous output, but decided it made more sense to skip the overhead of executing screen if it won't be needed anyway for a simple one-shot command.

The definition of a "one-shot" command is somewhat open to interpretation.
This should not affect any existing usage, as omittingBackendType should result in the same behaviour as before.

Note: this also loses the extra "Connected to agent" and "reconnect ID" output from theexp rpty command. I didn't find them especially useful, but can easily add these back if needed.

@johnstcnjohnstcn self-assigned thisMar 19, 2025
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Cool, thanks for adding this. Having this configurable is very nice!

@@ -64,13 +66,20 @@ func New(ctx context.Context, logger slog.Logger, execer agentexec.Execer, cmd *
// runs) but in CI screen often incorrectly claims the session name does not
// exist even though screen -list shows it. For now, restrict screen to
// Linux.
backendType := "buffered"
autoBackendType := "buffered"
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: can we call thisplain? Otherwise it feels like we're leaking implementation details.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'll do this as a follow-up refactor 👍

// If the user specified a command, we'll prefer to use the buffered method.
// The screen backend is not well suited for one-shot commands.
backend = "buffered"
}
Copy link
Member

@mafredrimafredriMar 20, 2025
edited
Loading

Choose a reason for hiding this comment

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

Suggestion: It'd be nice to see this as a CLI flag too, to (auto,plain,screen).

Side-note: I guessscreen could even be calledmultiplexer to allow to swap out for e.g.tmux in the future.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, I considered having it a CLI flag, but hesitated exposing this internal implementation detail. It does make sense, especially with yourvim comment below.

return false
}
return true
}
Copy link
Member

@mafredrimafredriMar 20, 2025
edited
Loading

Choose a reason for hiding this comment

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

This has some interesting repercussions when it's neither a shell and not a one-shot command. Imagine doingvim /my/file.txt. Here we would return true butvim is one of the reasons we have thescreen backend.

This is probably fine though, but I'm flagging this behavior as it's not ideal. At the very least worth a comment.

(The flag would alleviate this as you can enforce the behavior then.)

@johnstcnjohnstcn merged commit6862409 intomainMar 20, 2025
32 checks passed
@johnstcnjohnstcn deleted the cj/reconnectingpty-backend branchMarch 20, 2025 13:45
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 20, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@ThomasK33ThomasK33Awaiting requested review from ThomasK33

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@johnstcn@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp