Skip to content

Centralize durable transition and version advancement #239

Open

Description

@dominicnunez

Problem and intended outcome

Important Agent OS state transitions are currently assembled at multiple call sites using manually coordinated status, event label, version, correlation, and transition-detail values. Some callers depend on earlier writes consuming intermediate versions.

This is a latent correctness/recovery risk in the component that owns durable state-machine progression.

Introduce one small transition primitive or equivalent typed boundary that owns version advancement and transition consistency without redesigning the event ledger or performing a broad service refactor.

Scope

The change should focus on duplicated transition arithmetic and admission invariants such as:

  • expected previous/current revision;
  • next version;
  • event/transition label;
  • prior and resulting status;
  • stable correlation/tenant binding;
  • transition detail/evidence references.

Do not combine this work with a wholesale split of internal/app/service.go or internal/ledger/sqlite.go.

Acceptance criteria

  • Inventory current sites that manually coordinate durable status/version/event transitions.
  • Define one typed helper/boundary for the common invariant set or explicitly justify classes that cannot share one.
  • Callers no longer rely on undocumented +1/+2 version arithmetic coupled to a prior write in the same function.
  • Illegal version gaps, duplicate transitions, stale revisions, wrong correlation IDs, and wrong resulting statuses fail closed.
  • Recovery/event-only rebuild semantics remain unchanged and pass existing tests.
  • Add regression tests for at least one previously multi-step version sequence and one stale/concurrent transition.
  • No change to externally visible lifecycle semantics is made solely to simplify implementation.

Priority rationale

This is present maintainability/correctness hardening with plausible latent failure risk, but no confirmed user-visible defect has yet been demonstrated.

Activity

  1. added
    P2
    core architecture
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2core architecture

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions