8000 feat(run): add durable Run protocol by Fodesu · Pull Request #83 · felinics/twilight · GitHub
[go: up one dir, main page]

Skip to content

feat(run): add durable Run protocol - #83

Merged
Fodesu merged 1 commit into
feat/agent-runtime-core-09-run-statefrom
feat/agent-runtime-core-10-run-wire
Oct 3, 2026
Merged

Fodesu merged 1 commit into
feat/agent-runtime-core-09-run-statefrom
feat/agent-runtime-core-10-run-wire

Conversation

@Fodesu
@Fodesu Fodesu commented Oct 3, 2026 •
Copy link
Copy Markdown
Member

Summary

Add the durable Run protocol: canonical identities and digests, strict wire
encoding, frozen content storage, schema composition, and the transactional
RunStore port.

Protocol layers

  • canonical defines stable digest and identity derivations for each schema
    version.
  • wire encodes the sealed command and fact variants with explicit type
    discriminators.
  • frozen stores large request, result, output, and response bodies by digest,
    keeping facts small and replayable.
  • schema binds the Run state machine, canonical rules, identity rules, wire
    codec, snapshot codec, and frozen-body codec into one versioned contract.
  • store defines the transactional boundary for loading a Run and evaluating
    commands.

Wire format

Facts are persisted as typed canonical payloads. Commands use a typed envelope
containing the Run ID, command identity, discriminator, and command body.

The codec rejects:

  • unknown fields
  • unknown command or fact discriminators
  • malformed or empty payloads
  • trailing data
  • non-canonical JSON shapes
  • type/discriminator mismatches

Variant registration is schema-local, so a later schema version can add,
rename, or reshape variants without changing how earlier data is decoded.

Snapshots and frozen bodies

Machine snapshots flatten the interface-valued current step into an explicit
discriminator and one step body. Decoding restores the typed state and validates
its structural invariants.

Large content bodies are stored separately as content-addressed, versioned
envelopes. The digest is computed over the stored bytes and verified on both
write and read.

Transaction boundary

EvaluateCommit is the pure commit evaluator used by a RunStore:

validate envelope and derived identity
→ enforce terminal and base-position rules
→ Decide command into facts
→ Evolve facts into the next state
→ return detached facts and new state

The store adapter is responsible for replay lookup, atomic persistence, session
ownership, and durable fact encoding. The Run protocol itself remains
independent of storage and transport.

Cost model

Wire and frozen-body operations are proportional to the encoded payload size.
Variant dispatch is map-based, while commit evaluation operates on the current
state and emitted facts rather than replaying the full Run history.

@Fodesu
Fodesu added this pull request to stack #105 October 3, 2026 12:27
@Fodesu Fodesu changed the title feat/agent runtime core 10 run wire feat(agentcore): add durable run protocol Oct 3, 2026
@Fodesu
Fodesu marked this pull request as ready for review October 3, 2026 13:28
@Fodesu Fodesu changed the title feat(agentcore): add durable run protocol feat(run): add durable Run protocol Oct 3, 2026
@Fodesu
Fodesu removed this pull request from stack #105 October 3, 2026 16:13
@Fodesu
Fodesu added this pull request to stack #107 October 3, 2026 16:16
@Fodesu
Fodesu removed this pull request from stack #107 October 3, 2026 16:34
@Fodesu
Fodesu added this pull request to stack #108 October 3, 2026 16:37
@Fodesu
Fodesu removed this pull request from stack #108 October 3, 2026 16:51
@Fodesu
Fodesu added this pull request to stack #110 October 3, 2026 16:55
@Fodesu
Fodesu merged commit 03b49d5 into main Oct 3, 2026
16 checks passed
@Fodesu
Fodesu deleted the feat/agent-runtime-core-10-run-wire branch October 5, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0