Implementation update — canonical session contracts
Implementation is published in MR !18, branch ai/session-01-canonical-contracts, commit b601f06.
Implemented
- Added stable
UserID,SessionID,SessionEventID,FrontendBindingID, andSessionSnapshotIDidentities. - Added the canonical
Session, append-onlySessionEvent, optimisticFrontendBinding, tenant/user-scopedSessionParticipant, immutableSessionSnapshot, and snapshot-plus-contiguous-events context contracts. - Enforced exact-retry idempotency, conflict detection, strict per-session sequence progression, active/archive transitions, participant access, stale binding rejection, and event-kind ownership rules.
- Added a frontend-neutral
SessionStoreboundary for create, atomic create-and-switch (/new), bind/switch, append, archive/unarchive, list, and ordered history. - Replaced
Conversation/ContextEpochinRunwith canonicalsession_idandtrigger_event_id, and propagated both IDs through worker jobs and harness execution requests. - Removed the domain
ContextEpochandCleanContextEventAPIs. - Updated
AGENTS.md,README.md, anddocs/contracts.mdin public English to make Sessionless authoritative and Telegram/harnesses adapters.
Compatibility boundary
This issue deliberately does not implement the canonical YDB schema or new Telegram handlers. The existing Telegram/YDB adapter now exposes its old counter only as LegacyContextRevision and derives stable temporary session/event IDs. This keeps the current executable slice working without treating the legacy counter as a product API; #21, #22/#36, and #23/#37 remove that bridge.
Verification
make cipassed: generate, vet, race tests, all nine binaries, and foundation integration tests.ydbintegration,localintegration, ande2elocaltagged suites compile successfully.git diff --checkpassed.- The GitCode push mirror reached
finished; GitHub Actions is now the remaining merge gate.
Issue remains open until mirrored CI is green and MR !18 is merged.


Completion report
MR !18 was squash-merged into main as commit cddf901.
The canonical session and event contracts are now implemented and documented. The same change also makes local startup schema-safe: make dev-up starts infrastructure, waits for YDB, applies migrations, and only then starts schema-dependent services. A clean-volume verification confirmed that application services no longer emit missing-table noise during database bootstrap.
Post-merge GitHub Actions is fully green: run 30922860994.
- Go verification: passed
- YDB schema and state store: passed
- Local multi-service stand, including clean initialization and restart preservation: passed
- Terraform environments: passed
- Runtime images: passed
The acceptance criteria for this issue are satisfied.


Parent and architecture
Outcome
Replace the Telegram-authoritative conversation contract with frontend-neutral, platform-owned canonical session and event domain contracts before changing persistence adapters.
Estimate
Scope
Session,SessionEvent,FrontendBinding,SessionParticipantandSessionSnapshot.session_idandtrigger_event_idto the harness-neutral run/work contracts.context_epochas a reset boundary. Snapshotversionremains materialization metadata only.AGENTS.md;README.md;docs/contracts.md;Non-goals
Acceptance criteria
/newhas one meaning: create a new canonical session and switch a frontend binding.context_epochreset semantics remain in domain APIs.