Skip to content

metaFromEvents is gone: nothing rebuilt an agent meta from a whole log (#1039) - #1696

Merged
suleimansh merged 1 commit into
mainfrom
drop-meta-from-events
Aug 24, 2026
Merged

metaFromEvents is gone: nothing rebuilt an agent meta from a whole log (#1039)#1696
suleimansh merged 1 commit into
mainfrom
drop-meta-from-events

Conversation

@suleimansh

Copy link
Copy Markdown
Contributor

🤖 automated#1039, on Suleiman's "delete it rather than re-open".

What

  • store/agent-store.ts: metaFromEvents deleted; store/index.ts no longer re-exports it.
  • Tests: agent-store.test.ts used it as the fixture behind 15 fold tests (base = metaFromEvents(RUN.slice(0, 3), AT)) and had one test of the function itself; cloud-session-link.test.ts used it to fold the driver's events. Both now fold through a real AgentStore (openappend each event → snapshot()), which is the live path the store actually runs. The function's own test is gone with it.
  • agent-store.SPEC.md, agent-store.test.SPEC.md: the claim that a meta rebuilt by replaying a whole log equals the live one is removed — nothing does that any more.

Why

#1039: the function had no production caller, and it folded every event with startedAt, so a rebuilt meta's updatedAt equalled startedAt. Rather than fix an export nobody consumes, it goes.

Verified

  • build, typecheck, test: node 1581/0, dashboard 834/834.
  • Break-check: emptying the session-link fold (append skipped) fails that test on "the meta must carry the deep link"; restored, 1/1. Emptying the 15 fold tests' base does not fail them — they refine from the base and assert on the refinement only, exactly as on main; the three seed events are context, not a contract.
  • FEATURES-SPEC.md untouched: no user-facing change.

SPEC changes

packages/framework/src/store/agent-store.SPEC.md

Intro + TL;DR unchanged. One paragraph under "Folding events into the agent meta":

@@ -32,7 +32,7 @@ The user opens an agent and sees a header: what it was asked for, which coding a
 
 #### Business logic
 
-An agent's every fact arrives as an event appended to its event log, and the agent meta is the running fold of those events. Folding is the same operation whether it happens as an event is appended or by replaying a whole log from scratch, so a record rebuilt after a restart says exactly what the live one said.
+An agent's every fact arrives as an event appended to its event log, and the agent meta is the running fold of those events: each appended event refines the record, and the record is stored beside the log rather than rebuilt from it.
 
 The agent meta carries: whether the agent is running, done, stopped or failed; its id and its start and last-update times; the process and host that own it; what it was asked for; which driver and workspace it uses; the wrapped CLI's session id, session link and the agent-chosen session name; the branch its work is on; the ticket it implements, when the framework picked one; the pull request opened for it; whether it signalled ready for merge; what its handoff is armed to do and how that handoff reported back; the gate it is parked on; whether it has settled on the user; for a cloud session, whether the browser bridge holds a question it is parked on, and whether another machine's daemon started the agent — both marked by the daemon on the way to the dashboard, never stored; the port its browser preview listens on; its run target and, for a relayed agent, the device label; whether it started as a build or a direct prompt; the model the current leg runs; and, for a cloud session, the hand-off anchor commit.
 

The old sentence described metaFromEvents's replay path as a property of the store. With no replay, the true statement is the remaining one: the meta is the running fold, stored beside the log, refined per appended event.

packages/framework/src/store/agent-store.test.SPEC.md

@@ -11,7 +11,6 @@ What the tests cover: how an agent's record is written, summarized, archived and
 
 **Folding events into the agent meta**
 
-- Rebuilding the agent meta by replaying a whole log yields the same summary as folding events as they are appended.
 - A later request refines the seeded one.
 - The model is recorded per leg: the latest leg wins, and a leg that reports no model leaves it unknown rather than inheriting.
 - Handoff arming is mirrored, including whether merge is armed, without padding fields the arming never stated.

The bullet described the deleted test.

#1039)

The export had no production caller — the meta is stored beside the log and refined per
appended event — and it anchored updatedAt to startedAt on replay, so any future caller would
have inherited a wrong last-touched time. The tests that used it as a fixture now fold their
base through a real store, the way a live run does.
@suleimansh
suleimansh merged commit cf4d9ab into main Aug 24, 2026
2 checks passed
@suleimansh
suleimansh deleted the drop-meta-from-events branch August 24, 2026 17:53
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