Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, '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" + '
fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, '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('^' + ".*" + ' fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, '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('^' + ".*" + ' fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, '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" + ' fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, '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('^' + ".*" + ' fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, '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); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); fix(runtime-host): bind managed retirement to one service generation by M4n5ter · Pull Request #3600 · apache/maka · GitHub
Skip to content

fix(runtime-host): bind managed retirement to one service generation - #3600

Merged
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation
Aug 23, 2026
Merged

fix(runtime-host): bind managed retirement to one service generation#3600
M4n5ter merged 1 commit into
mainfrom
investigate/3583-managed-retirement-generation

Conversation

@M4n5ter

Copy link
Copy Markdown
Member
English

Summary

Fix the managed Runtime Host retirement identity gap from #3583.

After an exact Host passes host.upgrade.prepare, the CLI now waits for that Host to release the State Root writer, verifies that the managed service PID has not changed, and holds the writer fence across backend.stop() and the stable-stopped check. If a successor changes the service identity or wins the State Root first, retirement fails closed before calling stop, instead of stopping the successor as if it were the prepared Host.

The existing PID-less/startup fence path and normal retirement tests remain unchanged. The new regression models Host A crashing, Host B acquiring the State Root, and verifies that stop is not called.

Fixes#3583

Verification

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js — 17 passed, including the new successor-generation regression.
  • npx biome check packages/cli/src/runtime-host-service-manager.ts packages/cli/src/__tests__/runtime-host-service-manager.test.ts — passed.
  • git diff --check — passed.
  • The current-main CLI typecheck is blocked by two existing errors in packages/cli/src/pi-transcript.ts:512,515 (CompleteEvent.contextCompactionOutcome is missing); neither changed file contributes an error.
  • The repository npm run build:test is likewise not a clean baseline on this head: it reaches unrelated current-main UI type errors in packages/ui.

Root cause

The previous PID-known retirement path validated Host A before prepare, but did not carry generation authority through service stop. A crash after prepare could let Restart=always start Host B, after which systemctl stop stopped B while the result still reported A as retired.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed substantively to the bounded runtime-host implementation and regression test under human direction. The human contributor owns review and submission. The commit retains the Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — typecheck remains blocked by the unrelated current-main errors listed above.

Does this PR entail a change in behavior?

  • Yes — managed retirement now fails closed on a service-generation or State Root identity change instead of stopping a successor.
  • No
简体中文

概要

修复 #3583 中 managed Runtime Host 退场时的 service generation identity gap。

精确 Host 通过 host.upgrade.prepare 后,CLI 现在会等待该 Host 释放 State Root writer,确认 managed service PID 没有变化,并在 backend.stop() 与稳定 stopped 检查期间持有 writer fence。如果 successor 改变 service identity 或先取得 State Root,退场会在调用 stop 前 fail closed,而不会把 successor 当成原先准备退场的 Host 停掉。

现有的 PID-less/startup fence 路径与正常退场测试保持不变。新增回归测试模拟 Host A 异常退出、Host B 取得 State Root,并确认不会调用 stop

修复 #3583

验证

  • node --test packages/cli/dist/__tests__/runtime-host-service-manager.test.js:17 项通过,包含 successor generation 回归测试。
  • 两个变更文件的 npx biome check:通过。
  • git diff --check:通过。
  • 当前 main 的 CLI typecheck 被 packages/cli/src/pi-transcript.ts:512,515 的两个既有错误阻塞(CompleteEvent.contextCompactionOutcome 缺失);两个变更文件没有产生 typecheck 错误。
  • npm run build:test 同样被当前 main 中无关的 packages/ui 类型错误阻塞。

根因

原 PID-known 退场路径只在 prepare 前验证 Host A,没有把 generation authority 延续到 service stop。如果 A 在 prepare 后异常退出,Restart=always 可能启动 Host B;之后 systemctl stop 实际停止 B,但结果仍会报告 A 已退场。

AI 使用

  • 无生成式工具实质参与
  • 生成式工具有实质参与

工具与范围:OpenAI Codex 在人工指导下实质参与了限定范围的 runtime-host 实现与回归测试。人工贡献者负责 review 与提交。commit 保留 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该变更,且缺少该变更时会失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过——typecheck 仍被上述无关的 current-main 错误阻塞。

本 PR 是否改变行为?

  • 是——managed retirement 在 service generation 或 State Root identity 变化时 fail closed,不再误停 successor。

Wait for the prepared Host to release the State Root, then hold the writer fence through service stop. Fail closed when a successor changes the managed service PID before the fence is acquired, instead of stopping the successor.
Generated-by: Codex
@M4n5ter
M4n5ter marked this pull request as ready for review August 23, 2026 12:45

@jackwenerjackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kabi publisher approval at exact head b6fd775bc17351a3ede978b6e22f07995bb460b0.

Execution: kabi-sol-review-orchestrator, representing WAWQAQ under Raft authorization f380cfac for Maka review actions. The independent code judgment was sealed separately on this exact head before publisher reconciliation.

The new prepared-retirement fence closes the successor race at the correct authority boundary: after Host A prepares and releases the State Root, the manager must acquire that Root fence before stopping the service; if another service generation has already won the Root, the PID recheck rejects retirement and never calls stop(). The regression drives that production path with A at PID 42 and successor B at PID 43, and would fail if the fence acquisition were removed.

Local maka-agent suite passes 402/402. Hosted test is completed/success on this exact head. package and audit are intentionally not applicable: their checked-in workflow path filters do not include either changed CLI source file, so no run is expected for this diff. PR is OPEN, non-draft, and MERGEABLE. The three GitHub review/discussion endpoints are empty; no live P0-P2 finding remains.

No merge action taken; merging remains for a human committer.

@M4n5ter
M4n5ter merged commit 2a545af into mainAug 23, 2026
1 check passed
@M4n5ter
M4n5ter deleted the investigate/3583-managed-retirement-generation branch August 23, 2026 13:04
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.

fix(runtime-host): bind managed retirement to one service generation

2 participants

@M4n5ter@jackwener