Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
feat(runtime): add durable continuation authority by zhiiw · Pull Request #1573 · apache/maka · GitHub
Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(runtime): add durable continuation authority by zhiiw · Pull Request #1573 · apache/maka · GitHub
Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(runtime): add durable continuation authority by zhiiw · Pull Request #1573 · apache/maka · GitHub
Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' feat(runtime): add durable continuation authority by zhiiw · Pull Request #1573 · apache/maka · GitHub
Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(runtime): add durable continuation authority by zhiiw · Pull Request #1573 · apache/maka · GitHub
Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); feat(runtime): add durable continuation authority by zhiiw · Pull Request #1573 · apache/maka · GitHub
Skip to content

feat(runtime): add durable continuation authority - #1573

Merged
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness
Jul 31, 2026
Merged

feat(runtime): add durable continuation authority#1573
likun666661 merged 14 commits into
apache:mainfrom
zhiiw:codex/runtime-continuation-correctness

Conversation

@zhiiw

@zhiiwzhiiw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This change establishes durable continuation correctness on top of the canonical RuntimeEvent recovery store.

  • derives continuation cursors only from immutable RuntimeEvents using versioned composite boundaries;
  • materializes one provider replay projection per lineage segment and binds its digest to the claim;
  • adds SQLite-owned unique continuation claims with exact source and target execution identity;
  • makes runtime_admission continuation-start the only durable provider-call T1, backed by an opaque one-shot admission receipt;
  • converges claim-only and pre-provider crashes with deterministic claim_repair start + terminal facts and zero provider calls;
  • rejects active or non-terminal source claims inside the SQLite transaction, so an erroneous caller cannot seal a live Run.

Primary invariant

A durable continuation may call the provider only after one versioned composite immutable boundary has been rebuilt, revalidated, and atomically claimed. Every lineage segment uses the same replay projection. Only a continuation-start durably committed by the SQLite authority with start_kind=runtime_admission grants provider execution authority; claim_repair is audit-only and never grants execution.

Ownership and atomicity

  • Boundary/replay owner: core boundary codecs plus the shared runtime replay materializer.
  • Claim owner:SqliteRuntimeStore; BEGIN IMMEDIATE re-reads the latest immediate-source ledger, validates identity, position, and digest, requires exactly one terminal RuntimeEvent at the tail, checks an empty exact target, and inserts the claim.
  • Provider admission owner:RuntimeKernel and the package-private one-shot admission proof/receipt consumed by RuntimeRunner.
  • Repair owner:SessionManager classifies durable claim/start/terminal state before generic ledger repair.

Claim and continuation-start failures roll back their SQLite transactions. A rejected non-terminal claim creates no row and does not seal the source, so the active Run can still commit its terminal fact.

Failure states and rollback

  • missing, stale, corrupt, non-terminal, or suffix-bearing source boundaries fail closed before provider dispatch;
  • exact claim retry returns the existing claim and does not create another target;
  • claim-only or target-created-without-start crashes converge through deterministic repair with provider call count 0;
  • a durable live start without a terminal fact remains continuation_started_indeterminate unless ownership can be proven;
  • unknown authority/projection versions, mismatched target headers, claim rows, starts, terminal tails, or replay digests park instead of falling back.

Existing provider retry compatibility

The hosted runtime currently uses a file RuntimeEvent store and does not yet own the SQLite continuation authority lifecycle. To avoid regressing its existing child provider-429 retry, this change keeps an explicit legacy_provider_retry lane:

  • it is selected before claim, Run creation, or provider T1 only when continuation authority and the safety inspector are both absent;
  • partial capability installation fails closed instead of falling back;
  • it reads immutable RuntimeEvents and revalidates the immediate source before execution;
  • it never writes a continuation claim, continuationSource, or continuation-start;
  • it cannot retry a repaired pre-provider abandonment and carries no durable resume or cross-process exactly-once guarantee.

A later host authority lifecycle integration will replace and remove this compatibility lane.

Compatibility

  • supports the released populated SQLite schema 5 to schema 6 upgrade;
  • mutable partial snapshots remain UI-only and never contribute to a durable cursor;
  • JSONL may be read for legacy history but does not provide durable continuation claim authority;
  • unpublished experimental databases from feat(runtime): complete Phase 3A file-transaction recovery #1346 are intentionally outside the compatibility contract.

Explicitly out of scope

This change does not implement general typed retry/reattach, Bash replay, ShellRun reattach, conversation-clone evidence rewriting, ContinuationExecutionProfileV1, Write/Edit file checkpoints, workspace/Git checkpoints, hosted SQLite authority lifecycle integration, or default hosted auto-resume. Those remain separate changes because they have different owners and failure boundaries.

Validation

After rebasing onto upstream/main@e4c6ddbf:

  • Core boundary/decoder/AgentRun V2 focused tests: 54/54
  • SQLite store/schema/claim/start/terminal/multi-process tests: 43/43
  • Runtime continuation/replay/admission/planner focused tests: 46/46
  • SessionManager continuation, authority, branch-preflight, and upstream-conflict tests: 25/25
  • real-process continuation SIGKILL harness: 1/1, covering five durable boundaries
  • UI resume copy: 4/4
  • monorepo typecheck passes
  • hosted linked-child production-shape retry completes through the explicit compatibility lane; its assertions verify that no durable continuation lineage or start fact is written

These are focused proofs for the affected paths; this description does not use CI green as a substitute for concurrency, crash, or data-safety reasoning.

@zhiiw
zhiiw marked this pull request as ready for review July 31, 2026 15:03
@likun666661
likun666661 merged commit cf095e1 into apache:mainJul 31, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@zhiiw@likun666661