symfonic.agent.cutover.bundle¶
bundle ¶
What the composition root authorised, and what it can actually serve.
KernelDelegate must not take a raw list of capabilities. A list is a
request; this is a decision already made — folded in the composition root,
where the host knows which capabilities it trusts, and transported unchanged
through the delegate. The delegate carries it; it does not compose it.
The bundle exists because :data:~.policy.BASELINE_OVERRIDES pins
auto_hydrate=False, and lifting that pin needs evidence rather than a flag.
Legacy's auto_hydrate does two separable things, and both have to travel:
- ranked retrieval — a
MemoryRetrievalPort; - the conversation window — a
ConversationSource.
Half of that is the dangerous shape. An agent admitted with retrieval and no
conversation source serves a prompt missing the block that goes first, the
most recent thing the user said, and the model answers plausibly regardless.
Nothing raises; the only symptom is an assistant that appears to have stopped
listening. So :meth:RetrievalBundle.serves_hydration requires both, and the
envelope asks it rather than trusting the caller.
RetrievalBundle
dataclass
¶
RetrievalBundle(retrieval: Any = None, conversation: Any = None, onboarding: Any = None, router: Any = None, identity: Any = None, writes: Any = None, lifecycle: Any = None, system_prompt: Any = None, stages: tuple[Any, ...] = (), stage_handlers: Mapping[str, Any] = dict(), authorized_effects: frozenset[str] = frozenset(), capability_names: tuple[str, ...] = (), tools: tuple[tuple[str, Any], ...] = (), delegation: Any = None, extensions: Any = None, human: Any = None)
The memory sources an authorised composition root handed to the kernel.
Both fields default to None so an incomplete bundle is constructible
and refusable. Making them required would move the failure to
construction, which sounds stricter and is worse: the composition root
would raise at startup with no way to say "this deployment serves recall
but not the window", and the envelope would never get to explain which half
is missing.
missing ¶
The segments that cannot be served, named for the refusal message.
Named rather than counted: "the bundle is incomplete" sends a reader to re-derive which half, and the two halves fail in different ways.
Source code in src/symfonic/agent/cutover/authorised.py
serves_consolidation ¶
Both halves, because staging without committing recalls nothing.
write alone is not evidence, for the reason
:meth:serves_retrieval gives about retrieve: the write port's own
contract says "Pending memories are not retrievable until
MemoryLifecyclePort.flush". A bundle that stages and cannot commit
would be admitted, would run the write stage, and would leave a store
that recalls nothing — admitted, answered, and empty.
Source code in src/symfonic/agent/cutover/authorised.py
serves_delegation ¶
Whether a child can actually be reached from an admitted turn.
Asked by the envelope before sub_agents is admitted, and asked of
the bundle rather than of the agent for the reason
:meth:serves_hydration is: an agent that declares children and a
bundle that carries no way to reach them is the half-shape. The turn
would be served, the model would never be offered run_agent, and
the parent would answer the question itself -- plausibly, with nothing
raised. Both halves travel or the envelope stays closed: a capability
that can name its children, and at least one bound tool for the model
to reach them with.
Source code in src/symfonic/agent/cutover/authorised.py
serves_extensions ¶
Whether a loaded plugin can actually reach an admitted turn (TA8.21).
Asked by the envelope before plugins is admitted, and asked of the
bundle for the reason :meth:serves_delegation is. The half-shape
here is the quietest one in this migration: an agent with a plugin
loaded, admitted onto a path where nothing harvests it, is served
normally -- the model answers, nothing raises, and the plugin's
instructions are simply not in the prompt while its
validate_state_transition is never asked.
Both halves travel or the envelope stays closed: a capability, and evidence its contribution actually landed in this fold. The second is checked by stage id rather than by presence, because a capability object that was passed and then contributed nothing -- an empty composition, a fold that skipped it -- is exactly the state that looks wired and is not.
Source code in src/symfonic/agent/cutover/authorised.py
serves_human ¶
Whether a turn admitted here could actually stop and be answered.
Asked by the envelope (_human_refusal) before an agent carrying a
_human_interaction capability is admitted, of the bundle for the
reason :meth:serves_extensions is asked of it, and
checked by stage id rather than by presence for the same reason: a
capability object that was passed and then contributed nothing --
nothing registered, no per-run binding resolver, no token encoder -- is
exactly the state that looks wired and is not. An agent in it would
offer ask_user to the model, or worse would not, and either way a
human-in-the-loop consumer would wait for a pause that no stage in the
compiled plan can raise.
Source code in src/symfonic/agent/cutover/authorised.py
serves_hydration ¶
serves_identity ¶
serves_onboarding ¶
serves_retrieval ¶
Both seams, because the composition needs both.
retrieve alone is not evidence. PortCandidateSource requires
scan_candidates -- the gates that decide what survives run after
retrieval, so a capped read starves them -- and a bundle claiming to
serve recall on the strength of retrieve was admitted by the
envelope and then refused by the fold. Admission has to ask for what
composition will demand, or the refusal arrives after the decision that
depended on it.
Source code in src/symfonic/agent/cutover/authorised.py
serves_routing ¶
Whether a turn's palette can actually be narrowed.
contribute alone is not evidence for the same reason retrieve
was not: the boundary binds what the snapshot holds, so a router that
cannot answer leaves the plan's binding in place and the turn is offered
every tool -- which is the disabled behaviour wearing an admission.
Source code in src/symfonic/agent/cutover/authorised.py
serves_system_prompt ¶
Whether an authored system prompt travels and can be read.
Separate from :meth:serves_hydration because they lift separate pins:
an agent may hydrate without shaping a system prompt, and one that
shapes a prompt without hydrating is equally valid. Folding them into
one predicate would make each flag wait on the other's evidence.
Source code in src/symfonic/agent/cutover/authorised.py
fold_retrieval_bundle ¶
fold_retrieval_bundle(*, retrieval: Any = None, conversation: Any = None, scope: Any = None, limit: int = 5, recent_turns: int = 5, exclude_speakers: frozenset[str] = frozenset(), min_relevance: float = 0.0, min_salience: float = 0.0, order: int = 0, system_prompt: Any = None, context_window: int | None = None, prompt_share: float | None = None, chars_per_token: int | None = None, writes: Any = None, lifecycle: Any = None, records_from: Any = None, identity: Any = None, onboarding: Any = None, router: Any = None, delegation: Any = None, extensions: Any = None, human: Any = None) -> RetrievalBundle
The composition root: two ports in, one authorised bundle out.
This is the only place the memory stack is assembled for the migrated path,
and assembling it here is the point — KernelDelegate transports a
decision already made, it does not compose one. A delegate handed a raw
list of capabilities would be a delegate deciding what a host trusts.
The chain is short because #14 chose to reuse the composition that exists rather than build a second one:
- the retrieval port becomes a
CandidateSource; RetrievalCoordinatorranks, gates and blends scopes;WorkingWindowreads the conversation through its own source;HydrationCoordinatorcomposes both — window first, then recall, under one ceiling with one drop ledger — and is the single owner of that order.
recent_turns defaults to a real number rather than to
WorkingWindow's own 0. That default means "disabled without being
unwired -- skip the round trip entirely", which is the correct default for
a window an adopter assembles deliberately and precisely the wrong one
here: this function exists to serve both segments, and taking the class
default would have wired a conversation source that is never called. The
first version of this function did exactly that, and the integration test
is what found it. 0 is now refused rather than silently honoured.
min_relevance, min_salience and exclude_speakers are TA8.37's
(C1-C) threading of the deployment's own retrieval gates, and they default
to "no gate" because a composition root that states none must get the
behaviour it got before they existed. They are values, not policy
objects, for the reason recent_turns is a number: the composition root
knows the deployment's configuration and this function knows the
capability's shape, and handing a RetrievalPolicy across that seam
would make the caller import the capability to configure it.
Only these three. The layer set, the ranking weights and the scope blend
are honoured by the retrieval engine the port wraps -- they are already in
the answer it returns -- so restating them on the coordinator's policy
would be two components deciding one ranking, which is the defect
PortCandidateSource's pre_ranked flag exists to prevent.
context_window, prompt_share and chars_per_token are the
deployment's budgeting, bound to the compiler here because neither side of
that seam may import the other -- :mod:symfonic.agent.cutover.budget.
delegation is a DelegationCapability the composition root already
built over the parent's children (TA8.12). It is folded like any other
capability rather than special-cased, which is the point: its contribution
is tools, and until this task the fold had nowhere to put one and raised.
Passing None -- what every agent with no child passes -- folds no
delegation and changes nothing.
extensions is an ExtensionsCapability over the agent's loaded
plugins (TA8.21), folded the same way and for the same reason. Its
contribution is a resolution stage: it harvests each plugin's prompt hook
once per turn and leaves compiler-ready mappings in the turn's snapshot,
which is where prompting reads them. Folded before prompting because a
fragment that arrived after the compile is a fragment that is not in the
prompt -- the ladder already guarantees resolution precedes compilation,
and the stage's optional_before says so a second time.
human is a HumanInteractionCapability the composition root wired
over its own signer, ledger and checkpoint ports (TA8.34). Folded the same
way and for the same reason; it is the first capability to contribute
both halves -- a pre-tool stage that stops the run and the
ask_user tool the model reaches for -- and neither is special-cased
here. None for every agent whose deployment wired no pause transport,
which folds nothing and changes nothing.
Imported inside the function on purpose: agent.cutover must not take a
module-level dependency on the memory capability, or every agent that never
hydrates would import the whole memory stack to construct a plan.
Source code in src/symfonic/agent/cutover/bundle.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |