← Back to Pull requests

feat(runtime-host): bridge event waits to Goal continuation #6147

Closed
unknown closed this pull request without merging on Oct 19, 2026 14:03 UTC
View on GitHub
unknown unknown commented on Oct 18, 2026 07:28 UTC
Author

Summary

PR2 persists event-wait observations but does not resume Goal execution. This implements the PR3 execution-bridge plan: a Turn registers a wait, ends normally and releases execution resources; bounded observation makes no work-model or Goal-evaluator calls; a result or timeout can then admit at most one effective successor through existing Root admission.

  • Atomically link wait registration, source settlement and the existing Goal continuation in SQLite and the independent Memory provider. Freeze successor IDs and input across busy admission and recovery, and acknowledge delivery in the Root admission transaction.

  • Gate ordinary Goal evaluation, timers and recovery while delivery is outstanding, preserving normal accounting, permission and budget checks, user-input priority, and control-generation fencing.

  • Carry typed result provenance through execution and recovery. WaitForEvent remains internal and absent from production catalogs; production adapters, the ShellRun entry point and UI remain in PR4.
  • Refs #5926 and #5920. Builds on #6057 and #6113.

    Verification

    Final source: 7fe6963f6da7fd9964536978dbf7056c74efbe29. The latest follow-up changes only recovery documentation and protocol comments; executable behavior and tests are unchanged from 5386b1dfc.

  • Final-source checks passed with Node 24.18.0 / npm 11.19.0: root build, lint, typecheck, Desktop/UI Knip, git diff --check, and the protocol epoch guard against main 21f1cc1c2 (224 → 225). Normal commit hooks passed.

  • Formatting passed on a complete snapshot of the tracked source. The checkout-wide command flags pre-existing, untracked investigation scripts, which were preserved.

  • After the final build, the protocol suite passed 93/93 on Node 22.23.2. Immediately before this documentation follow-up, the Goal Root, protocol, event-wait manager, storage bridge and storage authority suites passed 483/483 serially on the same Node version. This includes both lost-admission-acknowledgement cases and the reported Retry-After case; it does not establish the cause of the reviewer's intermittent failure.

  • Earlier validation at 5386b1dfc passed 1,053/1,053 focused Node 24 tests and 47/47 Goal Root tests on Node 22. CI 39218667755 passed on that earlier head; this is not a claim about CI on the new head.
  • The first sandboxed 483-test run could not initialize storage authority locks; the unchanged command passed outside the sandbox. No fresh full-workspace test run, full Electron run, production-adapter test or exhaustive Host-process crash test was performed for this follow-up. SQLite kill/reopen and consistent-snapshot tests establish their respective storage/recovery boundaries, not full Host-process crash coverage.

    Migration and recovery

  • Workflow schema 14 → 15 updates active-wait and delivery indexes. Same-root backups retain linkage; portable Session copies discard it and pause linked Goals.

  • Protocol compatibility epoch 224 → 225 covers typed event-wait provenance rejected by older strict decoders. Public turn.start permissions remain unchanged. Re-check the epoch against main before merging if another incompatible protocol change lands first.

  • Queued results retain their frozen identities across recovery. If admission commits but its acknowledgement is lost before Root-owner adoption, the Host drains and fences the Session. Restart closes an admitted Goal Turn without a Run as app_restarted and pauses the Goal; explicit user resume starts a fresh continuation without redelivering the old wait. This is not transparent retry of an uncertain execution. The internal bridge README now documents this procedure.
  • AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: OpenAI Codex assisted with implementation, regression tests, review and documentation. Both commits retain Generated-by: OpenAI Codex; retain attribution in the final squash commit.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally (format scope and test snapshots are stated above)
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • Diff: 559 lines (+419 / -140) across 6 files Reviewer: me2seeks Review duration: 1834m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 559 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.379
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6147"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 48.2% (MEDIUM) · Higher = larger blast radius
    48.2%
    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: 60.5% · Lower = rushed or shallow review
    60.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: 19% · Safe to merge
    19%
    Repository