← Back to Pull requests

feat(storage): add dormant event-wait authority #6057

Merged
chinawch007 merged 22 files (3157 lines) on Oct 12, 2026 05:44 UTC
View on GitHub
chinawch007 chinawch007 commented on Oct 10, 2026 16:54 UTC
Author

Summary

This PR adds durable, lease-scoped event-wait records for future event-driven Session wakeups. It implements PR1 of the implementation plan, following the original requirements discussion #5920.

  • Add a bounded, provider-neutral v1 wait contract and persistence with CAS revisions, immutable identity/results, keyset pagination, and one active wait per Session. SQLite and the independent in-memory backend share the same contract tests.

  • Add workflow schema migration 12 → 13 and atomic cleanup on Session archive/removal/purge.

  • Preserve wait records in full State Root backups. Session copies and portable Bundle export/import do not transfer subscriptions; import independently excludes wait records even when an older bundle or snapshot contains them.
  • This is the dormant contracts/persistence slice. Observers, timers, provider adapters, tool exposure, Goal scheduling, and automatic continuation belong to later PRs. A recorded resolution does not establish current Goal authorization, verify external conditions, or admit successor execution.

    Refs #5926

    Compatibility

  • The new build supports existing workflow-12 State Roots and migrates them to workflow schema 13 while preserving existing data. After migration, older builds that support only workflow schema 12 cannot reopen that State Root: the existing schema-version guard rejects it rather than attempting a downgrade.

  • ExecutionPersistence now requires an eventWaitStore port. Custom persistence providers must implement it; there is no implicit Local fallback.

  • This PR does not change the Runtime Host wire protocol or its compatibility epoch.
  • Verification

  • Passed: clean full build, lint, format, workspace typecheck, and both Knip checks (apps/desktop, packages/ui).

  • Ran all 11 standard workspaces selected by the CI planner, with MAKA_STORAGE_STRESS=1, plus Runtime Host. Initial parallel runs had timing failures and incomplete Electron/Python setup. After completing setup, the failed Runtime/Desktop/release test files passed serially; the complete CLI and Runtime Host suites passed with file concurrency 1 and 2 respectively. Eval Python tests passed with Python 3.12.14.

  • Storage: 1,636 passed / 5 skipped; CLI: 1,361 passed / 3 skipped; Runtime Host: 2,336 passed / 12 skipped. Skips require another platform or the optional native Gitoxide helper. Renderer architecture, locale/TUI copy, Astryx inventory/theme, protocol epoch, and release contract checks also passed, with the release timing tests verified by the isolated rerun above.

  • Verified the Bundle regression tests fail when the import-side wait exclusion is removed; restored implementation passes.

  • Not run locally: Linux sandbox smoke, published-baseline forward-roll qualification, live Docker egress proxy, native Gitoxide helper contracts, and release CLI pack/smoke. These need Linux/Docker/Rust tooling or a built helper unavailable on this host. Desktop E2E and Storybook were not selected by the CI planner.
  • AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: OpenAI Codex assisted with implementation, tests, review fixes, rebase conflict resolution, and this description. The commit includes Generated-by: OpenAI Codex.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above

  • No
  • Diff: 3157 lines (+3139 / -18) across 22 files Reviewer: me2seeks Review duration: 2210m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.95) × (1 − Review Confidence (0.66)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.95 · 3157 lines diff across 22 files
    0.95
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.42 · 1 substantive comment(s)
    0.42
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    66%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Sensitive Paths sensitive_paths
    0.095
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    5 items
    Astro-Han Astro-Han commented on Oct 10, 2026 17:35 UTC
    Reviewer

    Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

    At c2bb6ec85b25f490320b7f83c10acbb6075a47d8, I found no P0–P3 correctness issue in the bounded wait contract, persistence, migration, or Session cleanup/transfer behavior.

    The wait functionality remains dormant: no production tool, observer, timer, Goal scheduler, or continuation path creates or consumes these records. A recorded resolution is not proof of current Goal authorization, external truth, or successful execution admission. Those guarantees still need the later integration; this change does not demonstrate an end-to-end event-wakeup benefit.

    There are immediate compatibility consequences despite that dormancy. Opening an existing root upgrades workflow schema 12 to 13, and ExecutionPersistence gains a required eventWaitStore port. I created a real schema-12 root using current main, including conversation history and a valid Goal, then opened it with this head: the data survived, only the workflow version advanced, and integrity checks passed. The old main build subsequently rejected schema 13 without changing the database hash. Landing the preparatory slice therefore also means accepting that older-build downgrade limitation; the linked implementation proposal is not evidence of maintainer approval.

    Full-root backups retain subscriptions. Session transfers deliberately do not: portable exports omit waiting/resolved records, and import independently excludes them even when an older bundle or snapshot retains them. Removing that import exclusion made the two snapshot regression cases fail; restoring it passed all four cases. Two independent Node processes racing the same revision produced exactly one commit and one revision conflict, with the result surviving reopen.

    The normal clean build:test completed, all 352 tests across the 11 affected contract/storage/export and existing provider/transfer files passed with no skips, and Biome passed for all 22 changed files. This is not a claim that I ran the entire monorepo suite, live providers, or future observer/admission behavior.

    The protocol epoch remains the inherited 215; no wire-protocol file changed. This head merges cleanly with main 16a8f5b8445ee0fca2c170aa02943d73fb73af6c. The test run, audit, and label checks are successful. GitHub reports MERGEABLE but its overall merge state remains BLOCKED.

    chinawch007 chinawch007 commented on Oct 11, 2026 15:34 UTC
    Author

    Thanks for the review and for checking the migration, CAS, and Bundle transfer behavior.

    Agreed on the scope: this PR only adds dormant contracts and persistence. A stored resolution does not establish current Goal authorization, verify external conditions, or admit a successor execution. Those guarantees remain requirements for the later observer and continuation integration PRs; this slice does not claim an end-to-end wake-up benefit.

    I have updated the PR description with an explicit Compatibility section:

  • Existing workflow-12 State Roots can be opened by the new build and migrated to schema 13 while preserving existing data. After migration, older builds supporting only schema 12 cannot reopen that root, consistent with the existing schema-version guard.

  • Custom ExecutionPersistence providers must implement the new required eventWaitStore port.

  • The Runtime Host wire protocol and compatibility epoch remain unchanged.
  • Regarding the proposal's status, the motivation, requirements, architecture boundaries, and staged implementation were already presented in detail in the linked Discussion #5920. No objections have been raised there so far. On that basis, I think it is reasonable to proceed with this bounded PR1 implementation and bring it through the normal code-review process. The issue comment provides the concrete implementation plan for that scope; I am not presenting it as formal maintainer approval. Acceptance of the implementation and its compatibility implications remains part of this PR's review.

    The backup and transfer boundaries are also intentional: full State Root backups preserve wait records, while Session transfers exclude them, including import-side filtering when an older bundle or snapshot contains wait rows. CAS protects concurrent record updates; it does not establish exactly-once successor execution.

    me2seeks me2seeks approved these changes on Oct 12, 2026 05:27 UTC
    Approved Reviewer

    Approved these changes.

    Astro-Han Astro-Han commented on Oct 12, 2026 05:30 UTC
    Reviewer

    Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

    I reviewed the increment from c2bb6ec8 to d9269e45cd86ba9ffa7bf4ccc800c5f99557493e. The authored patch is unchanged: its stable patch identity matches, and range-diff shows only an operational-state test's incoming-main context. I found no new P0–P2 correctness issue.

    The important new combination is main's incremental-vacuum initialization with this PR's workflow schema 12 → 13 migration. I built the actual new base at 105302c6 and created two populated workflow-12 roots through its real Session and Goal APIs: a newly initialized incremental-vacuum database, and an existing database retaining vacuum mode NONE. After rebuilding this PR's Core and Storage, both roots migrated to 13 while preserving Session history, Goal record bytes, other schema scopes and their original vacuum mode. Two independently opened child processes raced an update in each root: exactly one committed revision 1 and the other received a revision conflict; reopen, foreign-key and integrity checks passed. Rebuilding the actual workflow-12 base and attempting to open each upgraded root rejected it without changing its database-file hash. This tests the new integration, not merely a reconstructed old schema.

    Fresh lockfile installation, dependency patches and the normal workspace test build passed. Eleven complete contract/storage/backup/transfer/export test files passed all 353 tests with MAKA_STORAGE_STRESS=1, with no failures, cancellations or skips. Removing only the import-side wait-table exclusion from generated code made both snapshot Bundle tests fail; restoring it passed all four portable/snapshot cases. Biome checked all 22 changed files, and diff and protocol checks passed. I did not rerun the entire repository suite.

    The prior scope and compatibility boundaries remain: full State Root backup preserves waits, Session transfers do not, custom persistence providers must supply the required port, and workflow-12 builds cannot reopen migrated roots. The records remain dormant: no observer, timer, external-condition verification or successor execution is enabled here. A resolution and CAS revision do not prove current Goal authorization or exactly-once continuation.

    The exact-head test run and dependency-audit check succeeded. The result merges cleanly with main at 27a9d051, and compatibility epoch 217 is inherited with no wire-protocol change. Technical migration/contract checks do not establish the feature's necessity or approve its adoption. The author's explanation acknowledges that the discussion and implementation plan are not formal maintainer approval; the schema upgrade and staged design still need the project's human acceptance. I did not test future wakeup behavior, live external providers, native helpers, packaged releases or the full end-to-end continuation system.

    Reviewers
    Assignees
    chinawch007 chinawch007
    Labels
    risk: low confidence: 66.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 94.7% (HIGH) · Higher = larger blast radius
    94.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 66.5% · Lower = rushed or shallow review
    66.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 31.8% · Safe to merge
    31.8%
    Repository