Repository navigation
Replies: 2 comments
|
Verified against master c291e79 (agent.ts / validation.ts unchanged since rc.2). The ordering is real: agent/pre-step fires in preStep before session.append('step/start') (agent-loop/src/agent.ts:249-255 vs :302), and durable user/message is accepted anywhere (core/session/src/invariant.ts:149-150), so a pre-step append lands before the system/message head materialized inside the step (:370-372); the V3 validator requires that head as the protected first surface (validation.ts:42-45) - the write/read asymmetry is real. Two corrections: the error is thrown as SessionFormatError with that exact message (validation.ts:43); SessionFormatUnsupportedMigrationError belongs to a different path. And on master the default v3 read uses validation:'transformed' (format.ts:366-375), which skips restoreReleasedV3Artifact for already-v3 logs (catalog.ts:131-137) - the head check fires on strict/current validation or v2->v3 migration, so which path your restore hit is worth checking. Your decision.messages workaround is confirmed durable-after-head (agent.ts:370-377); suggestion 2 (reject pre-head appends at write time) is still unaddressed on master. |
|
Verified against commit Thanks for the detailed report β I verified this end to end against current master. The root cause is real, with one correction on the error class, one on which restore path rejects the log, and one nuance on the "documented 0.1.2 pattern" claim. Confirmed: the write orderingThe chronology you describe is exactly what the loop produces. In
So a Confirmed: the write path accepts it
Confirmed: the restore validator requires the head
Correction 1: the error class:43 throws Correction 2: which restore path rejects the logOn master and rc.2, the default released-log read does not run the head check for already-v3 logs:
The head check fires only on (a) Nuance on the "documented 0.1.2 pattern"The injection channel documented even in 0.1.2-rc.1 is the pre-step decision batch, not a pre-step On the three suggestions
Summary of the report
Unverified: the exact restore entry point/stack behind your quoted error class, and whether your affected sessions are seeded/forked (relevant to any write-side guard design). |
Uh oh!
There was an error while loading. Please reload this page.
Found while upgrading our plugin stack from 0.1.2-rc.1 to 0.1.5-rc.2.
Symptom
A session that the live rc.2 writer produces cannot be restored: restoring its own released log fails with
Root cause
In rc.2,
agent/pre-stepfires beforestep/startis appended to the session log (packages/core/agent-loop/src/agent.ts,preStep()runs ahead ofsession.append('step/start', β¦)). A plugin that appends a durableuser/messagetoagent.sessioninside its pre-step handler therefore lands before the step β and before thesystem/messagehead, which is only materialized inside the step.Example chronology from a real session (persisted without error by the live writer):
V3 requires
system/messageto be the protected first surface head, so this log β which the writer itself produced β is rejected by the restore validator (restoreReleasedV3Artifact).Write/read asymmetry
The write path accepts pre-head appends; the restore path rejects them. Any plugin doing durable pre-step injection (a documented pattern in 0.1.2 for getting context into the first request) silently produces sessions that die on resume.
Suggestions (any of)
decision.messages), which is persisted after the head.Workaround we adopted
We moved our seed injection from
session.appendto the pre-step decision messages ({ kind: 'enter', messages: [seed, ...claimed] }), which persists inside the step after the head β durable, restore-safe, and still ahead of the first model request. Reporting so other plugin authors do not trip the same asymmetry.All reactions