Skip to content

feat(execution-history): add plugin-owned run persistence - #81

Closed
aryasaatvik wants to merge 1 commit into
contrib/execution-history-integration-basefrom
contrib/execution-history-plugin
Closed

feat(execution-history): add plugin-owned run persistence#81
aryasaatvik wants to merge 1 commit into
contrib/execution-history-integration-basefrom
contrib/execution-history-plugin

Conversation

@aryasaatvik

@aryasaatvik aryasaatvik commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

Add an owner-scoped execution-history plugin that records runs, tool calls, and interactions without coupling persistence to the execution engine. The SDK surface stays intentionally small: list, get, and listToolCalls.

Lifecycle

ExecutionStarted
  -> persist running row

ExecutionFinished
  -> write blob outbox when available
  -> atomically publish run + details + cleanup marker
  -> remove outbox + marker

Read of a nonterminal run
  -> replay any durable outbox through the same atomic publication
  • If the blob store is unavailable, terminal history publishes directly through the transactional database batch.
  • Recovery failure never makes already-persisted history unreadable.
  • Waiting snapshots remain inspectable across observer restarts; resuming paused execution remains an engine/session responsibility.

Review context

This review branch uses a temporary integration base containing the exact patches from upstream PRs UsefulSoftwareCo#1097, UsefulSoftwareCo#1098, and UsefulSoftwareCo#1119. PR UsefulSoftwareCo#1098 wraps generic FumaDB bulk writes in a transaction and uses native D1 batching where interactive transactions are unavailable, keeping each terminal publication atomic across supported adapters.

HTTP APIs, React surfaces, actor attribution, Cloudflare service-token identity, and host wiring remain follow-up layers.

Validation

  • package typecheck and 5 focused tests, including restart replay, unavailable-outbox fallback, read availability during replay failure, and cleanup exhaustion
  • oxfmt --check . '!.scratchpad/**'
  • oxlint -c .oxlintrc.jsonc . --deny-warnings --ignore-pattern '.scratchpad/**'
  • bun run lint:changelog-stubs
  • bun run typecheck (45/45 tasks)
  • TURBO_TEST_CONCURRENCY=1 bun run test (39/39 non-e2e tasks)
  • local Greptile incremental review on b0fadaf7a: 4/5 configured threshold, zero comments

The repository-wide formatter excludes the ignored .scratchpad working-memory directory, which has unrelated pre-existing violations.

@aryasaatvik
aryasaatvik marked this pull request as ready for review August 27, 2026 18:27
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds an owner-scoped execution-history plugin that persists runs, tool calls, and interactions through plugin storage.

  • Buffers lifecycle details and atomically publishes terminal history.
  • Uses blob-backed outboxes and database cleanup markers for restart recovery.
  • Exposes list, get, and listToolCalls SDK methods.

Confidence Score: 3/5

The PR is not yet safe to merge because synthetic anchors can become permanent and completed runs can remain hidden from filtered history while recovery fails.

A combined outbox and terminal-publication failure can leave an unrecoverable running anchor, and best-effort replay still allows completed executions whose replay fails to be excluded from completed-only list results.

Files Needing Attention: packages/plugins/execution-history/src/sdk/store.ts

Important Files Changed

Filename Overview
packages/plugins/execution-history/src/sdk/store.ts Implements buffered lifecycle persistence, atomic terminal publication, outbox recovery, cleanup, and read APIs; two previously reported recovery behaviors remain outstanding.
packages/plugins/execution-history/src/sdk/store.test.ts Covers completed history, waiting-state persistence, restart replay, unavailable outbox fallback, replay cleanup failure, and cleanup exhaustion.
packages/plugins/execution-history/src/sdk/collections.ts Defines owner-scoped run, tool-call, interaction, and terminal-cleanup storage schemas and indexes.
packages/plugins/execution-history/src/sdk/plugin.ts Registers the storage collections, SDK extension, and execution observer as one plugin.
packages/plugins/execution-history/package.json Adds package metadata, workspace dependencies, and package-local build, typecheck, and test scripts.

Sequence Diagram

sequenceDiagram
  participant Engine
  participant History as Execution History
  participant Blob as Blob Outbox
  participant DB as Plugin Storage
  participant Reader

  Engine->>History: ExecutionStarted
  History->>DB: Persist running run
  Engine->>History: Tool calls and interactions
  History->>History: Buffer details
  Engine->>History: ExecutionFinished
  History->>Blob: Write terminal publication
  History->>DB: Atomically publish run, details, marker
  History->>Blob: Delete outbox
  History->>DB: Remove cleanup marker
  Reader->>History: Read nonterminal run
  History->>Blob: Load pending publication
  History->>DB: Replay atomic publication
  History-->>Reader: Return terminal history
Loading

Reviews (16): Last reviewed commit: "feat(execution-history): add plugin-owne..." | Re-trigger Greptile

Comment thread packages/plugins/execution-history/src/sdk/store.ts Outdated
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from 910ddb3 to 9d79021 Compare August 27, 2026 18:37
Comment thread packages/plugins/execution-history/src/sdk/store.ts
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from 9d79021 to 264f999 Compare August 27, 2026 19:08
Comment thread packages/plugins/execution-history/src/sdk/store.ts Outdated
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch 2 times, most recently from 3179d07 to 1d5dd93 Compare August 27, 2026 20:01
Comment thread packages/plugins/execution-history/src/sdk/store.ts Outdated
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from 1d5dd93 to 0155e02 Compare August 27, 2026 20:13
Comment thread packages/plugins/execution-history/src/sdk/store.ts
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from 0155e02 to 29e6ea1 Compare August 27, 2026 20:17
Comment thread packages/plugins/execution-history/src/sdk/store.ts Outdated
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch 2 times, most recently from 865b3c8 to cfe8467 Compare August 27, 2026 20:33
Comment thread packages/plugins/execution-history/src/sdk/store.ts
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch 4 times, most recently from 2203aff to 599ade0 Compare August 27, 2026 21:06
Comment thread packages/plugins/execution-history/src/sdk/store.ts Outdated
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from 599ade0 to b0fadaf Compare August 27, 2026 21:11
Comment thread packages/plugins/execution-history/src/sdk/store.ts
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from b0fadaf to f96c62a Compare August 27, 2026 21:18
@aryasaatvik
aryasaatvik force-pushed the contrib/execution-history-plugin branch from f96c62a to 48532a2 Compare August 27, 2026 21:22
@aryasaatvik

Copy link
Copy Markdown
Owner Author

Iterative review now continues locally with greptile review --branch contrib/execution-history-integration-base --agent. The polished execution-history layer remains available on contrib/execution-history-plugin and will return as an upstream PR once its prerequisite stack is ready. Closing this fork PR avoids redundant CI/review runs; the branch, commits, discussion, and compare URLs are preserved.

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