8000 feat(run): add version-bound state machine by Fodesu · Pull Request #82 · felinics/twilight · GitHub
[go: up one dir, main page]

Skip to content

feat(run): add version-bound state machine - #82

Merged
Fodesu merged 1 commit into
feat/agent-runtime-core-08-writer-testsfrom
feat/agent-runtime-core-09-run-state
Oct 3, 2026
Merged

Fodesu merged 1 commit into
feat/agent-runtime-core-08-writer-testsfrom
feat/agent-runtime-core-09-run-state

Conversation

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

Summary

Add the version-bound Run state machine and its command/fact transition model.

State model

MachineState is the complete semantic state of one Run:

  • lifecycle status and terminal result
  • the current ModelStep or ToolStep
  • pending inputs
  • model usage
  • the most recently completed tool step

Model and tool effects are represented by stable EffectIDs. Execution
attempts, workers, leases, and backend ownership remain outside the Run state.

Content bodies are also kept outside the state machine. Facts retain canonical
digests, while frozen request/result stores own the corresponding bodies.

Transition model

The machine exposes two pure operations:

  • Decide: validates a command against the current state and emits facts.
  • Evolve: validates and folds one fact into the next state.

Supported transitions cover:

  • accepting and consuming inputs
  • preparing, starting, recovering, rejecting, and settling model steps
  • opening tool steps and starting, settling, declining, or responding to calls
  • approval and external-response waits
  • cancellation and terminal Run results

Commands and facts are sealed variants. Stale step, effect, call, and response
identifiers are rejected by the transition guards.

Identity and replay

The machine is bound to explicit canonicalization and identity rules. It does
not compute digests or derive IDs itself, so a Run replays under the rules of
the schema version that created it.

Unknown external outcomes are represented explicitly rather than guessed:
unknown model outcomes terminate the Run, while unknown tool outcomes settle
the call as uncertain and leave the Run active.

Operational characteristics

Transitions are in-memory and deterministic. Their work is proportional to the
command/fact payload and the affected current step; they do not scan the full
Run history. History replay is performed by repeatedly applying Evolve.

@Fodesu
Fodesu added this pull request to stack #105 October 3, 2026 12:27
@Fodesu Fodesu changed the title feat/agent runtime core 09 run state feat(agentcore): add version-boundStateModel Oct 3, 2026
@Fodesu
Fodesu marked this pull request as ready for review October 3, 2026 13:23
@Fodesu Fodesu changed the title feat(agentcore): add version-boundStateModel feat(run): add version-bound state machine 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 701cd21 into main Oct 3, 2026
16 checks passed
@Fodesu
Fodesu deleted the feat/agent-runtime-core-09-run-state 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