Repository navigation
fix(dgw): end a recording its producer closes as ended #2116
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
irvingouj@Devolutions (irvingoujAtDevolution)
merged 12 commits into
master
from
fix/jrec-push-ended
Oct 28, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e434a81
fix(dgw): end a recording its producer closes as ended
irvingoujAtDevolution 139c88d
docs(dgw): state how a push close ends a recording
irvingoujAtDevolution 447711d
refactor(dgw): map the push close code before the recording module
irvingoujAtDevolution aeb0c90
fix(dgw): end the recording on 4011 even if the last write failed
irvingoujAtDevolution c932eb4
docs(dgw): name the asciicast push file type as the endpoint accepts it
irvingoujAtDevolution 4a5bd53
docs(dgw): name shadow viewers and allow a new push after 4011
irvingoujAtDevolution c4962f8
docs(dgw): say a recording is inactive once 4011 arrives
irvingoujAtDevolution 9c0bf1c
test(dgw): cite the recording intent in the push close tests
irvingoujAtDevolution 03e1d58
docs(dgw): tidy the wording of the recording intent
irvingoujAtDevolution 0edbdb2
test(dgw): cover an ended push while another waits
irvingoujAtDevolution 081c1f7
docs(dgw): mark ending a push on write error untested
irvingoujAtDevolution 9c6243d
test(dgw): name the fault the ended state check catches
irvingoujAtDevolution File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,23 @@ | ||
| # Recording | ||
| Gateway recording is a continuous stream of bytes pushed from the client who pocesses the valid recording token. | ||
| The url is `/jet/jrec/push/{sessionId}?fileType={fileType}`. | ||
| We expect the `fileType` to be one of the following file types: `webm`, `cast`, `trp` and `slog`, which must be specified. | ||
| When connection is established with request of recordings for the session, if recording is not enabled within a short period of time, the connection will be closed with indication of violation of the recording policy. | ||
| A recording is a continuous stream of bytes pushed by a client that holds a valid recording token. | ||
| A recording contains one or more clips. | ||
| The URL is `/jet/jrec/push/{sessionId}?fileType={fileType}`. | ||
| The `fileType` is required and is one of `webm`, `asciicast`, `trp` and `slog`. | ||
| When a session whose token requires recording starts and no recording starts for it within a short time, Gateway closes the session as a recording policy violation. | ||
|
|
||
|
|
||
| # Artifacts | ||
| Artifacts are files that are not recordings, currently only have `ai-analysis` with combination to `slog` file type. | ||
| Currently, we do not have an api endpoint to push artifacts, but we will have one in the future. | ||
| Artifacts are files that are not recordings; the only kind today is `ai-analysis`, stored with the `slog` file type. | ||
| An endpoint to push artifacts is wanted later. | ||
|
|
||
|
|
||
| # Ending a recording | ||
| We use WebSocket close code 4011 to indicate that the producer actively terminates the recording. | ||
| As soon as 4011 is received: | ||
| - the recording is no longer active; | ||
| - the shadow viewers are notified; | ||
| - the associated session is closed subject to the recording policy. | ||
|
|
||
| Every other close, including a WebSocket close without a code or with code 1000, and a connection lost without any close, is treated as a network interruption or a clip switch. | ||
| In that case, the recording stays active until its reconnection timeout passes. | ||
| Gateway does not refuse a later push for the same session with a new token after 4011. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Update
handleitself instead of providing two different functions (the new one beinghandle_with_received_close).Replace the tuple return value by a struct, so the values are named, and pattern matching is more readable at the callsite. It’s also easy to ignore the close code by just not reading the field of that returned struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8598084:
handlenow returns aHandledWebSocket { stream, close_handle, received_close }andhandle_with_received_closeis gone. The other callers (fwd,jmux,rdp) destructure with..and ignore the close code.Note
LLM-assisted content (no human feedback).