Skip to content

Prefer RuntimeEvent read model for session reads - #13

Merged
likun666661 merged 2 commits into
apache:mainfrom
likun666661:runtime-v2-aggressive-read-cutover
Jun 15, 2026
Merged

Prefer RuntimeEvent read model for session reads#13
likun666661 merged 2 commits into
apache:mainfrom
likun666661:runtime-v2-aggressive-read-cutover

Conversation

@likun666661

Copy link
Copy Markdown
Member

Summary

  • Make SessionManager.getMessages() and listTurns() prefer RuntimeEvent-projected session views when durable per-run runtime ledgers are usable.
  • Route retry/regenerate turn lookup, user-message lookup, and branch copy through the same RuntimeEvent-primary read view.
  • Expand RuntimeEvent read projection for assistant thinking, abort source metadata, and multi-run lineage.
  • Keep external IPC/preload/gateway/renderer contracts unchanged: callers still receive StoredMessage[] and TurnRecord[].

Rive

  • Workflow: wfrun_65d83dede37f4a8bb7af4375ab5fbb89
  • Scheduler: sched_715dace105ce4c7399692dafcfa46ff4
  • Final verdict: pass_with_risks

Fallback policy

RuntimeEvent reads fall back to legacy SessionStore for no runStore, no runs, active/non-terminal runs, missing/empty runtime ledgers, missing terminal RuntimeEvents, hard projection diagnostics, run-store read failures, or hard compatibility gaps.

MAKA_RUNTIME_READ_SOURCE=legacy forces legacy reads as an emergency rollback.

Known risks

  • AgentRunStore.readRuntimeEvents() still skips corrupt RuntimeEvent JSONL lines silently, so semantic compatibility remains the current safety boundary until storage exposes corruption diagnostics.
  • The runtime view sorts RuntimeEvents chronologically with deterministic tiebreakers; the initial contract mentioned listSessionRuns/per-run concatenation. Tests pass with the chronological policy, but this should stay visible in review.

Verification

  • npm run build --workspace packages/core
  • npm run typecheck --workspace packages/runtime
  • npm run test --workspace packages/runtime -- --runInBand (427 tests, 0 failures)
  • git diff --check
  • Rive stress node also ran npm run test --workspaces --if-present successfully, including desktop 1399 tests / 0 failures.

@likun666661

Copy link
Copy Markdown
Member Author

Follow-up risk cleanup is pushed in 6a27af44 Harden RuntimeEvent read cutover.

What changed:

  • AgentRunStore.readRuntimeEvents() now rejects durable corrupt RuntimeEvent JSONL rows instead of silently shortening the canonical ledger. Unterminated partial tails are still ignored as incomplete writes.
  • SessionManager.readSessionView() now treats runtime-ledger read failure as an explicit legacy fallback path and carries the read error in diagnostics.
  • Multi-run RuntimeEvent read ordering is locked to session chronology by RuntimeEvent.ts, with stable run/ledger/id tiebreakers and a regression test.
  • MAKA_RUNTIME_READ_SOURCE=legacy now has an explicit rollback test.

Verification:

  • npm run test --workspace packages/storage -- --runInBand: 80 tests / 10 suites / 0 failures
  • npm run test --workspace packages/runtime -- --runInBand: 430 tests / 86 suites / 0 failures
  • npm run build --workspace packages/core: pass
  • npm run typecheck --workspace packages/runtime: pass
  • git diff --check: pass
  • npm run test --workspaces --if-present: core 614, storage 80, runtime 430, desktop 1399, all 0 failures

Final verdict: pass.

@likun666661
likun666661 merged commit 71da853 into apache:main Jun 15, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…tover

Prefer RuntimeEvent read model for session reads
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…tover

Prefer RuntimeEvent read model for session reads
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…tover

Prefer RuntimeEvent read model for session reads
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…tover

Prefer RuntimeEvent read model for session reads
anaconda110 added a commit to anaconda110/maka-agent that referenced this pull request Aug 3, 2026
All current dependencies (React Native, keychain, sqlite, AppCompat,
Hermes) are hosted on google() and mavenCentral(); no dependency pulls
from JitPack. The extra repository only slows resolution and adds a
supply-chain surface, so drop it.
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