fix(apiproxy): serve history events and projections from one log position
Review found two defects in the previous commit's ordering fix. @pku-xht: `historyStateFor` copied the attached session's events, the handler then awaited `presenterScopeFor`, and only then read the projection baseline off the still-live Session. An append during that await served events cut at N beside a baseline folded to N+1 — one response describing two moments. The same restructure had also moved the baseline read outside the `try`, so a failing snapshot escaped the structured `internal` error. Both awaits now happen before the cut: `historySourceFor` resolves which session serves the read, `presenterScopeFor` ensures the recorded composition, and `historyCutOf` then reads events and baseline adjacently with nothing between them. The whole sequence is back inside the try. The invariant judged any scoped assembly with a chain of one as an unjoined agent, which rejects a legitimate assembly in a standing preset key (that key has no parent of its own). It now gates on `context.agent` — a scope-only read is not an agent and is out of range by construction rather than by a premise about who else calls `assemble` — and asks the roster's own `composedPreset()` instead of introspecting chain length. The advisory warning uses the same relation. Also from review: the `2026-08-05-per-agent-tool-presentation` note still described `presentAs` as per-agent, which standing mounts made false and this branch's own rewording contradicts; the duplicated "process-wide unit table" argument collapses to the Agent Note with pointers from the five copies; a dead `.sort()` before `arrayContaining`; and change-history narration in the tool-cordis README.
This commit is contained in:
@@ -301,16 +301,11 @@
|
||||
disabled: true
|
||||
|
||||
# The token METER stays on the host plane; only the compaction backend that
|
||||
# reads it moves. It takes no configuration at all, keys every fold by Session,
|
||||
# and registers no tool or prompt section, so one host instance serves every
|
||||
# preset exactly as before. It also owns the `tokenUsage`/`contextPressure`/
|
||||
# `contextBreakdown` projection units, and the projection registry is
|
||||
# process-wide rather than scope-layered: registered from inside a preset, the
|
||||
# browser's context meter would appear for a session whose own composition
|
||||
# mounts no meter as soon as some OTHER session mounted one, and disappear
|
||||
# entirely in a process that only ever ran `minimal`. That is the same criterion
|
||||
# `tasks` and `goals` are read by — a Service the host and every preset can see
|
||||
# belongs to the plane both can see.
|
||||
# reads it moves. It owns the context-meter projection units, and that table is
|
||||
# process-wide, so preset ownership would make the meter a function of which
|
||||
# presets happen to be mounted rather than a per-session fact. Same criterion as
|
||||
# `tasks` and `goals`; the reasoning has one home in
|
||||
# `.agents/notes/implemented/architecture/2026-08-10-host-plane-ownership-after-presets.md`.
|
||||
|
||||
- id: compact-basic
|
||||
disabled: true
|
||||
|
||||
Reference in New Issue
Block a user