GeezerVison is showing github.com — feat(fleet): laptop sessions, attach, spool cap and exec grace window (#15420) by dezren39 · Pull Request #15453 · developing-today/code
Conversation
dezren39
commented
Nov 26, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Before: polling a finished laptop-agent job stopped at the first reply. One reply carries at most 1 MiB per stream, so a job that spooled more than that lost the rest of its output the moment it read as done. A job's spool grew without bound. A dropped fleet http exec killed its command at once, with no way back to it. There was no fleet http view of daemon jobs as sessions.
After: this is B2 (#15420) of the #10356 decision record, in three commits.
- Sessions and full drain. The daemon reports
out_size and err_size on every GET /jobs/<id> reply. Both clients (fleet-laptop-agent in Rust and pkgs/fleet/laptop-agent.py) keep paging a done job until the cursors reach those sizes; against an older daemon they stop at the first empty page. fleet http sessions [--json] lists daemon jobs as connect sessions (id, origin, state, start, spooled bytes, bytes dropped, and the owning FLEET_CTX_ID when the caller exported one). fleet http attach JOB [--wait S] streams a session from the saved cursor.
- Spool cap (section 3.3). Each stream stops appending at
LAPTOP_AGENT_SPOOL_CAP (256 MiB by default; a bad value exits 3 at startup). The job keeps running and is never killed because its output grew. Replies and the job list carry out_dropped, err_dropped and bytes_dropped, and attach ends with an explicit [spool cap reached: N bytes dropped] line.
- Exec grace window (section 3.4).
POST /exec takes grace_s (1 to 600, one command). The client's trip id becomes the job id and the command runs as a spooled job from the start. A connected client gets the usual reply. A client that drops leaves the command in state grace; GET /jobs/<trip> in the window attaches to it as an ordinary job, and past the window it is reaped TERM then KILL and listed with reaped: true, spool intact. fleet http exec --grace S defaults to 60, and a dropped connection's error names the exact fleet http attach <trip> command. grace_s 0, the daemon default, is today's immediate reap, and tier 0 always sends 0 because it moves on to the next form after a failure and must not leave a copy running.
sshfb- jobs are not listed by sessions: they exist only on the SSH path, which the HTTP tier excludes by construction, so they belong with the ssh tier's sessions (B4, #15422).
How:
- The Rust poll loop is now
drain(), with the fetch, cursor-save and sleep steps as closures, so it is tested without a daemon: a finished job over 1 MiB returns every byte with and without sizes, resume from saved cursors, a stalled cursor, a running job that finishes, the deadline, a malformed reply, and the cap marker. fleet http tests cover --grace parsing, the request body (no grace_s key at 0) and the attach hint.
- POST /jobs no longer hands the spool files to the job. A small pump process per job (stdlib Python, its own session like the job) reads the job's pipes, appends up to the cap, and writes the counts beside the spool as
stdout.dropped and stderr.dropped. Because the pump has its own session, a daemon restart neither kills the job nor stops its spool. A finished job reads as done once the pump has drained, bounded at 2 s so a grandchild holding the pipe cannot keep a job running. No meta.json field changes, so the restore table is untouched; grace and reaped live in memory, and a restart turns a running job into an interrupted one exactly as before.
- POST /jobs and the grace path share
_spawn_job. Daemon tests cover sizes and paging, the pump alone, the counts in both serializers, a job past a 1000-byte cap that still exits with its own code, the startup check, the connected grace reply under its trip, attach after a drop, the reap after the window, and bad grace_s values.
- The T2 section of
book/reference/laptop-route-forms.md documents the verbs, the cap and the grace window.
Also fixes main's red fleet-rust-tests (#15448): PR #15378 wired kv set --global --force-blob through the upload door, so crates/fleet/tests/kv_cli.rs now expects central_not_configured for it instead of pending_needs_phase3. Test-side only.
Fixes #15420
Fixes #15448
Generated by Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…he end (#15420)
A finished laptop-agent job with more than 1 MiB spooled was read
as done after the first page, so poll stopped there and the rest of
the output was lost. The daemon now reports out_size/err_size on
every single-job reply, and both clients (fleet-laptop-agent in Rust
and pkgs/fleet/laptop-agent.py) keep paging a done job until the
cursors reach the sizes, or a page carries nothing for older daemons.
fleet http gains sessions [--json] (daemon jobs as connect sessions,
with origin, state, spooled bytes, bytes dropped and the recorded
FLEET_CTX_ID) and attach JOB [--wait S].
Part of #15420 (B2 of #10356): the spool cap and the exec grace
window follow.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
coderabbitai
Bot
commented
Nov 26, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 23 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
119d726e-6623-4f1a-bb3e-c801c08dcdda
Commits
-
Reviewing files that changed from the base of the PR and between d0815d8 and d3a4d74.
Files selected for processing: 7
-
pkgs/fleet/book/reference/laptop-route-forms.md
pkgs/fleet/crates/fleet-laptop-agent/src/client.rs
pkgs/fleet/crates/fleet/src/http.rs
pkgs/fleet/crates/fleet/tests/kv_cli.rs
pkgs/fleet/laptop-agent.py
pkgs/laptop-agent/src/laptop_agent.py
pkgs/laptop-agent/tests/test_laptop_agent.py
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…5420)
POST /jobs now spools through a small per-job pump process that
appends each stream up to LAPTOP_AGENT_SPOOL_CAP (256 MiB default)
and counts the bytes past it. The job keeps running and is never
killed because its output grew. Replies and the job list carry
out_dropped, err_dropped and bytes_dropped, and fleet http attach and
the Python client end with an explicit [spool cap reached: N bytes
dropped] line. The pump runs in its own session, so a daemon restart
neither kills the job nor stops its spool.
Refs #15420
Co-Authored-By: Claude Opus 5.5 <[email protected]>
dezren39
changed the title
feat(fleet): http sessions and attach; drain finished job spools to the end (#15420)
feat(fleet): http sessions and attach, full spool drain, and a spool cap (#15420)
Nov 26, 2026
)
POST /exec takes grace_s (1-600, one cmd). The trip id becomes the job
id and the command runs as a spooled job from the start. A connected
client gets the usual reply; a client that drops leaves the command in
state grace, where GET /jobs/<trip> attaches to it as an ordinary job;
past the window it is reaped TERM then KILL and listed as reaped with
its spool. grace_s 0, the default, keeps the immediate reap.
fleet http exec gains --grace S (0-600, default 60) and names the
fleet http attach command when the connection drops. Tier 0 sends no
grace, since it moves on to the next form after a failure.
POST /jobs and the grace path now share _spawn_job.
Fixes #15420
Co-Authored-By: Claude Opus 5.5 <[email protected]>
dezren39
changed the title
feat(fleet): http sessions and attach, full spool drain, and a spool cap (#15420)
feat(fleet): laptop sessions, attach, spool cap and exec grace window (#15420)
Nov 26, 2026
PR #15378 wired kv set --global --force-blob through the upload door,
so preflight no longer refuses it with pending_needs_phase3. With no
central store configured it is now answered central_not_configured
(69), like the other --global verbs, before anything is created.
Fixes #15448
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 26, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|