Agent state is defined three times with no single source of truth #87

Closed
opened 2026-10-04 00:09:52 +02:00 by clawdie · 0 comments
Owner

Agent state is defined three times with no single source of truth

Summary

The agent-state vocabulary is independently defined in three places across the
Clawdie platform, with no shared contract. Two of the three are the same
5-value model in different languages; the third is the bherdr pane subset.
Drift here is silent — a rename or new state in one copy breaks the others at
runtime, not at compile time.

The three definitions

Where Values Language
colibri/internal/zotrpc/events.go (State) idle, working, blocked, done, error Go
colibri/crates/colibri-glasspane/src/lib.rs (AgentState) Idle, Working, Blocked, Done, Error Rust
bherdr/internal/server/server.go (reportable) idle, working, blocked, unknown Go

The first two are the same 5-value model with the same fold semantics
(session→idle, turn/tool events→working, queue_update→blocked,
terminal→done, error sticky). They are independent copies, not a shared
type.

Finding (Jev probe, advisory)

question answer
is zotrpc.State a redundant duplicate of glasspane AgentState? 0.46 (uncertain — they are the same model)
do the three share one agreed source of truth? 0.26 (no)
consolidate? no 0.51 / partial 0.42

Jev correctly declines to be authoritative (confidences 0.26–0.46); the
duplication itself is plain from the sources.

Why it matters now

Colibri is migrating Rust → Go. The Rust AgentState (glasspane) will be
replaced by the Go zotrpc.State, but nothing binds them, and bherdr adds a
fourth consumer. This is the same class of problem the hive-capabilities
fixture pack already solved: capture the shared contract once, replay it in
every implementation.

Options

  1. Contract fixture pack testdata/contracts/agent-state/v1/ (mirrors
    task-slice/v1 and hive-capabilities/v1): the vocabulary, the fold rules,
    and cases; Rust and Go both replay it. Ownership stays with whoever owns the
    event source.
  2. Generate one from source — derive the enum from a single IDL or a
    go:generate step shared with the Rust build. Heavier; needs a codegen
    decision.
  3. Leave as-is and rely on the migration gate to reconcile when glasspane
    is deleted.

Recommendation

Option 1, scoped to the 5-value colibri model now, with the bherdr subset
recorded as a documented projection (idle/working/blocked shared; done/error
derivable). It is cheap, matches two existing fixture packs, and gives the
migration a replay target instead of a hope.

Refs: colibri internal/zotrpc/events.go, crates/colibri-glasspane/src/lib.rs;
testdata/contracts/task-slice/v1/, testdata/contracts/hive-capabilities/v1/.

# Agent state is defined three times with no single source of truth ## Summary The agent-state vocabulary is independently defined in three places across the Clawdie platform, with no shared contract. Two of the three are the *same* 5-value model in different languages; the third is the bherdr pane subset. Drift here is silent — a rename or new state in one copy breaks the others at runtime, not at compile time. ## The three definitions | Where | Values | Language | | --- | --- | --- | | `colibri/internal/zotrpc/events.go` (`State`) | `idle, working, blocked, done, error` | Go | | `colibri/crates/colibri-glasspane/src/lib.rs` (`AgentState`) | `Idle, Working, Blocked, Done, Error` | Rust | | `bherdr/internal/server/server.go` (reportable) | `idle, working, blocked, unknown` | Go | The first two are the same 5-value model with the same fold semantics (`session→idle`, turn/tool events→`working`, `queue_update→blocked`, terminal→`done`, `error` sticky). They are independent copies, not a shared type. ## Finding (Jev probe, advisory) | question | answer | | --- | --- | | is `zotrpc.State` a redundant duplicate of glasspane `AgentState`? | 0.46 (uncertain — they are the same model) | | do the three share one agreed source of truth? | **0.26 (no)** | | consolidate? | `no` 0.51 / `partial` 0.42 | Jev correctly declines to be authoritative (confidences 0.26–0.46); the duplication itself is plain from the sources. ## Why it matters now Colibri is migrating Rust → Go. The Rust `AgentState` (glasspane) will be replaced by the Go `zotrpc.State`, but nothing binds them, and bherdr adds a fourth consumer. This is the same class of problem the hive-capabilities fixture pack already solved: **capture the shared contract once, replay it in every implementation.** ## Options 1. **Contract fixture pack** `testdata/contracts/agent-state/v1/` (mirrors `task-slice/v1` and `hive-capabilities/v1`): the vocabulary, the fold rules, and cases; Rust and Go both replay it. Ownership stays with whoever owns the event source. 2. **Generate one from source** — derive the enum from a single IDL or a `go:generate` step shared with the Rust build. Heavier; needs a codegen decision. 3. **Leave as-is** and rely on the migration gate to reconcile when glasspane is deleted. ## Recommendation Option 1, scoped to the 5-value colibri model now, with the bherdr subset recorded as a documented projection (`idle/working/blocked` shared; `done`/`error` derivable). It is cheap, matches two existing fixture packs, and gives the migration a replay target instead of a hope. Refs: colibri `internal/zotrpc/events.go`, `crates/colibri-glasspane/src/lib.rs`; `testdata/contracts/task-slice/v1/`, `testdata/contracts/hive-capabilities/v1/`.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
clawdie/colibri#87
No description provided.