fix(client): end the held-input overflow only once an attachment begins
Clearing it at stream open let a later failure (deadline, worker, Begin) start another resume phase that accepted keys again after dropped ones.
- commit
- 261a65d3c543ad6084761acecba81ec2690836f4
- author
- brice · · 2026-10-08 06:22 UTC
- committer
- brice · · 2026-10-08 06:24 UTC
- parent
- 08ceb7f
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +5 -4
M internal/usecase/client/supervisor_attach.go +5 -4
| @@ -779,10 +779,6 @@ func (s *Supervisor) attachResolved(ctx context.Context, input *terminalInputLif | |||
| 779 | 779 | if supervisorNil(stream) { | |
| 780 | 780 | return s.attemptFailed(ports.BrokerError{Code: ports.BrokerErrorUnavailable, Text: "broker returned no stream"}, resuming) | |
| 781 | 781 | } | |
| 782 | - | if input != nil { | |
| 783 | - | // The outage ended: keys typed from now on reach the session again. | |
| 784 | - | input.resumeOverflowed.Store(false) | |
| 785 | - | } | |
| 786 | 782 | if err := deadline.adopt(stream); err != nil { | |
| 787 | 783 | // The accepted absolute deadline already elapsed before this client | |
| 788 | 784 | // saw the stream. Fail the attachment instead of restarting a budget. | |
| @@ -818,6 +814,11 @@ func (s *Supervisor) attachResolved(ctx context.Context, input *terminalInputLif | |||
| 818 | 814 | s.transition(supervisorEvent{kind: supervisorAttachEnded}) | |
| 819 | 815 | return attachmentEndedOutcome() | |
| 820 | 816 | } | |
| 817 | + | if input != nil { | |
| 818 | + | // The attachment owns input again: keys typed from now on reach the | |
| 819 | + | // session, so the outage's overflow ends here, not at stream open. | |
| 820 | + | input.resumeOverflowed.Store(false) | |
| 821 | + | } | |
| 821 | 822 | return s.settleAttachment(ctx, input, service, deadline, run, request, resuming) | |
| 822 | 823 | } | |
| 823 | 824 | ||
| @@ -779,10 +779,6 @@ func (s *Supervisor) attachResolved(ctx context.Context, input *terminalInputLif | |||||
| 779 | if supervisorNil(stream) { | 779 | if supervisorNil(stream) { | ||
| 780 | return s.attemptFailed(ports.BrokerError{Code: ports.BrokerErrorUnavailable, Text: "broker returned no stream"}, resuming) | 780 | return s.attemptFailed(ports.BrokerError{Code: ports.BrokerErrorUnavailable, Text: "broker returned no stream"}, resuming) | ||
| 781 | } | 781 | } | ||
| 782 | - | if input != nil { | |||
| 783 | - | // The outage ended: keys typed from now on reach the session again. | |||
| 784 | - | input.resumeOverflowed.Store(false) | |||
| 785 | - | } | |||
| 786 | if err := deadline.adopt(stream); err != nil { | 782 | if err := deadline.adopt(stream); err != nil { | ||
| 787 | // The accepted absolute deadline already elapsed before this client | 783 | // The accepted absolute deadline already elapsed before this client | ||
| 788 | // saw the stream. Fail the attachment instead of restarting a budget. | 784 | // saw the stream. Fail the attachment instead of restarting a budget. | ||
| @@ -818,6 +814,11 @@ func (s *Supervisor) attachResolved(ctx context.Context, input *terminalInputLif | |||||
| 818 | s.transition(supervisorEvent{kind: supervisorAttachEnded}) | 814 | s.transition(supervisorEvent{kind: supervisorAttachEnded}) | ||
| 819 | return attachmentEndedOutcome() | 815 | return attachmentEndedOutcome() | ||
| 820 | } | 816 | } | ||
| 817 | + | if input != nil { | |||
| 818 | + | // The attachment owns input again: keys typed from now on reach the | |||
| 819 | + | // session, so the outage's overflow ends here, not at stream open. | |||
| 820 | + | input.resumeOverflowed.Store(false) | |||
| 821 | + | } | |||
| 821 | return s.settleAttachment(ctx, input, service, deadline, run, request, resuming) | 822 | return s.settleAttachment(ctx, input, service, deadline, run, request, resuming) | ||
| 822 | } | 823 | } | ||
| 823 | 824 | ||||