Skip to main content

Module segments

Module segments 

Source
Expand description

This controller’s side of the segment index (backend::continuity_segments): each spawn is one segment of its agent’s conversation. Best-effort throughout: a failed write is logged and never affects the process.

Functions§

forked_outcome 🔒
The outcome of a relocated resume (spec §4.3): the fork reports its own id, which persistent_resume reads as the CLI starting fresh. Carrying the whole conversation into a new id is the resume succeeding.
kept_relocated_id 🔒
A relocated resume the CLI kept under the attempted id, resumed in place rather than forked. Capture skips an id the controller already holds, so this is settled on its own, once a result frame proves the resume worked (an earlier frame echoes the attempted id even when the resume goes on to fail). Left unsettled, the segment would hold no session (a relocated Start records none) and the next spawn would sweep the live copy. holds_current: the reader’s generation is still current and holds the id; a superseded one’s copy path may already be the replacement’s.
provider_bytes_for_segment 🔒
The provider session file’s size for segment id, from what its own record says about where it ran (spec §4.4). Claude only.
provider_file_size 🔒
The segment’s process went away. zone is its global transcript zone. Size of the Claude session file sid for cwd under config_dir; None when it isn’t there.
record_segment_end 🔒
record_segment_session 🔒
A fresh process reported its provider session id.
settle_relocated_copy 🔒
Once a relocated resume reports its session: a fork (a new id) never wrote the copy, so it goes. The same id back means the CLI resumed the copy in place instead of forking; it is live now, so only its marker goes, and the duplicate is logged (spec §3 I4). Returns whether the copy was still this spawn’s: a replacement’s sweep may have taken it and placed its own at the same path, which is then left alone.
spawn_config_dir 🔒
The config dir the spawn gives its provider: the provider’s own auth_config_dir_env_var (Gemini’s is GEMINI_CLI_HOME, not the GEMINI_CONFIG_DIR a hand-kept list here once named), else the first known provider’s variable the env carries.
zone_size 🔒
Size of output in the global zone, read from the database rather than this process’s cache, so another channel’s appends count.

Type Aliases§

SegmentRef 🔒
The segment a spawned process belongs to: (agent_uid, segment_id).