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(cli): add experimental rpty command#16700

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 4 commits intomainfromcj/cli-exp-pty-cmd
Feb 26, 2025
Merged

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedFeb 25, 2025
edited
Loading

Relates to#16419

Builds upon#16638 and adds a commandexp rpty that allows you to open a ReconnectingPTY session to an agent.

This ultimately allows us to add an integration-style CLI test to verify the functionality added in#16638 .

@johnstcnjohnstcn self-assigned thisFeb 25, 2025
@johnstcnjohnstcn changed the titleCj/cli exp pty cmdfeat(cli): add experimental rpty commandFeb 25, 2025
Base automatically changed fromcj/agent-pty-container tomainFebruary 26, 2025 09:03
@johnstcnjohnstcn marked this pull request as ready for reviewFebruary 26, 2025 09:06
Comment on lines +20 to +23
// This test will time out if the user has commit signing enabled.
if _, gpgTTYFound := os.LookupEnv("GPG_TTY"); gpgTTYFound {
t.Skip("GPG_TTY is set, skipping test to avoid hanging")
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: decided to add this drive-by since running the tests locally was hanging for me

mtojek and mafredri reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: Decided to move these to have a commonexp_ prefix. Also considered moving them to their own package but that would have been more involved.

mtojek reacted with thumbs up emoji
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

nothing blocking, I suppose

cmd := &serpent.Command{
Handler: func(inv *serpent.Invocation) error {
if r.disableDirect {
return xerrors.New("direct connections are disabled, but you can try websocat ;-)")
Copy link
Member

Choose a reason for hiding this comment

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

:)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I had to actually try it out and itdoes work! Except you have to enter raw JSON objects to write to the terminal...

mtojek reacted with heart emoji
Copy link
Member

Choose a reason for hiding this comment

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

This is very convenient for debugging purposes. Leave the websocat hint please!

require.ErrorContains(t, err, "not found")
})

t.Run("Container", func(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider a test case when container/agent dies?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Not a bad idea! I tested it out on dogfood and it works as expected, but good to codify.

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.

This is a really cool command to have, thanks for adding it! A few nits inline.

Comment on lines +110 to +115
for _, ct := range cts.Containers {
if ct.FriendlyName == args.Container || ct.ID == args.Container {
ctID = ct.ID
break
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Does the agent API support searching based on name/id? If not, might be nice to have the logic there (not a blocker for this PR though).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

No, just search by labels currently.

ContainerUser: args.ContainerUser,
Width: termWidth,
Height: termHeight,
})
Copy link
Member

Choose a reason for hiding this comment

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

Since this goes via coderd; do we need the "direct connection" check at all?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I discussed this with Ben and we agreed to keep it even though there's a trivial workaround. We can adjust based on customer feedback.

}); err != nil {
return
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Debounce would be "nice", but since this is an experimental command, I'm not pushing for it.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

What do you specifically mean by 'debounce' here? Multiple keypresses?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm..isn't it overengineering in this case?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't think the web terminal doesany debouncing, so this is potentially a later improvement in both cases.

@johnstcnjohnstcn merged commitc5a265f intomainFeb 26, 2025
30 checks passed
@johnstcnjohnstcn deleted the cj/cli-exp-pty-cmd branchFebruary 26, 2025 12:33
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 26, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri left review comments

@mtojekmtojekmtojek approved these changes

@SasSwartSasSwartAwaiting requested review from SasSwart

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@mafredri@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp