Allow Remote sessions to outlive connection forms

This commit is contained in:
ak47 committed 2026-11-04 17:19:19 -05:00
1 parent b60cf5d5f2
commit b4896a2eb4
10 files changed
+233 -16

No files matched your search

+15 -1
View File
@@ -76,6 +76,20 @@ func (runtime *tentacleRuntime) interact(ctx context.Context, command tentacleCo
if runtime.output.gate.Locked() || runtime.output.gate.Suspended() {
return
}
if value.RemoteBackground != nil {
lease := *value.RemoteBackground
lifetime, leaseErr := command.session.RemoteLeaseContext(lease)
if leaseErr != nil || ctx.Err() != nil || lifetime.Err() != nil || approvedEpoch != 0 && approvedEpoch != lease.Epoch {
runtime.report("Remote connection ended. Start a fresh access review.")
return
}
// The reader lease already belongs to the policy/session owner.
// Returning to the desktop releases form and interaction capture,
// without extending consent or running the cancellation continuation.
approvedEpoch, cleanupNext = 0, ""
runtime.output.Present(runtime.output.Capture(command.session.OutputContext()), value.Presentation, "tentacle/"+command.id)
return
}
cleanupNext = value.Next
if value.Remote != nil {
action, approvalErr := runtime.authorize_remote_session(ctx, command.session, value.Remote.Role, value.Remote.Grants)
@@ -255,7 +269,7 @@ func (runtime *tentacleRuntime) waitTentacleForm(ctx context.Context, command te
return internalUIResult{Cancelled: true}, nil
}
status, err := tentaclewire.DecodeInteraction(raw)
if err != nil || status.Form != nil || status.Source != "" || status.Next != "" || status.Reader != nil || status.Remote != nil {
if err != nil || status.Form != nil || status.Source != "" || status.Next != "" || status.Reader != nil || status.Remote != nil || status.RemoteBackground != nil {
command.session.Disable()
return internalUIResult{Cancelled: true}, nil
}