Expand description
The seat’s working tree: what a scan of it found, when that was, and the loop that keeps it fresh for the seats a view is showing.
The row is pushed, not polled. A view used to read the tree through
whatever read happened to need it, which for a client meant a whole-record
encode every time it wanted one number. Here the scan runs for a seat
somebody is looking at, its answer is stored beside the process walk, and
the row moves by itself as SessionUpdate::WorkChanged.
A seat nobody holds is not scanned: the hold IS what looking means, so a
fleet of unheld seats costs nothing. A HELD seat costs one scan per
SNAPSHOT_STALENESS while its tree is still, at most one per
POKE_INTERVAL while it moves, and one when its PR lookup is due - the
record a read serves carries the PR the last scan knew, so this loop is
where the refresh is paid. And a seat whose row has not moved
announces nothing, however often it is scanned - the frame says the tree
moved, never that time passed.
Re-exports§
use std::collections::HashMap;🔒use std::path::Path;🔒use std::path::PathBuf;🔒use std::sync::Arc;🔒use std::sync::Mutex;🔒use std::time::Duration;🔒use std::time::Instant;🔒use forge_agent::env::file_index::start_change_watch;🔒use forge_agent::env::processes::SCAN_STALENESS;🔒use forge_primitives::SessionSlot;🔒use forge_primitives::git::GitIssueRef;🔒use forge_primitives::git::GitPrInfo;🔒use forge_primitives::git_diff::BaseState;🔒use forge_primitives::git_diff::GitDiffSnapshot;🔒use forge_primitives::git_diff::GitWorkView;🔒use forge_primitives::git_diff::PrRefresh;🔒use crate::protocol::SessionUpdate;🔒use crate::workspace::Workspace;🔒
Structs§
- Announced 🔒
- The row a seat’s viewers were last told, which is what keeps a still seat from announcing itself again every time it is read.
- Held 🔒
- Held
File Index - A seat’s walked file index, and when it was taken.
- Held
Seats 🔒 - The seats a view is showing, and the loop each one runs.
- Taken 🔒
- A first hold’s share of the seat: the mark the record’s read fires, the wake a reported mutation fires, and the sender that stops the loop.
- Work
Snapshot - A seat’s last scan of its working tree, and when it was taken.
- Work
State - What one agent’s working tree looks like, and what git said about it.
Enums§
- Gate
- The repo gate, as a view reads it. Its own type so the view does not have to name the scanner’s.
Constants§
- INDEX_
STALENESS - How long a walked file index answers for: the window the socket’s own read
served it for before the push landed, so a seat’s
@list is no fresher and no staler than it was. - PINNED_
GATE_ WAIT - How long a drawing read waits for a scan already in flight.
- POKE_
INTERVAL - How often a held seat looks at its tree.
- SNAPSHOT_
STALENESS - How long a scan answers for: the staleness rule for the snapshot every view draws, so all views live with one freshness.
Statics§
Functions§
- adopted_
measurement 🔒 - The base measurement a scan adopts: the one its caller passed, else the checkout’s latest when that was established before the scan began.
- git_
work_ view - The tree behind a row’s depth, as both the record and its frames carry it:
the two layers a row draws, with
CleanandScanFailedboth reading as nothing to state - which is what the layer means, and the row above still carries the gate that says which. - local_
bash_ 🔒commands - The commands a walk hands the OS scan: each running
local_bashtask’s own command. - pinned_
gate_ 🔒wait - The bound a drawing read uses: production’s, or a test’s shorter one.
- reads_
again 🔒 - Whether a read whose answer was taken at
read_atshould be taken again, on the same three reasons for every read this module owns. - set_
pinned_ gate_ wait - A shorter gate wait for a test, in milliseconds;
0restores production’s. - should_
scan - Whether the tree should be read again.
- spawn_
work_ 🔒watch - One seat’s scan loop: the tree is watched, the poke reads it and walks the seat’s process tree and its files, and whatever moved goes to whoever is showing the seat.
- stopped_
while_ 🔒waiting - Whether the seat’s watch was stopped while it waited for the record’s mark: the holder went (the sender is dropped) or the stop fired. Either way the reads it was about to take are owed to nobody.
- walk_
moved 🔒 - Whether a walk carries news: the entries the seat’s viewers were last told against the ones this walk found.
- work_
from_ scan - The row a scan answers, from the scan and the directory it was taken of.