feat(runtime): consolidate tool and process lifecycle contracts#946
Closed
luoye520ww wants to merge 4 commits into
Closed
feat(runtime): consolidate tool and process lifecycle contracts#946luoye520ww wants to merge 4 commits into
luoye520ww wants to merge 4 commits into
Conversation
This was referenced Jul 14, 2026
Collaborator
|
感谢工具和进程生命周期方面的工作。关闭当前聚合 PR 的原因是它同时引入工具预算、子进程注册表和 PTY 登记;当前 请不要合入一个未被真实调用链使用的聚合合同。后续可基于最新 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Tool execution budgets and child-process lifecycle tracking were split across four small PRs. The contracts were not reviewable as one unit, and terminal PTY processes were not represented in the shared lifecycle registry.
Root cause
There was no bounded, shared resource contract for tool processes and no main-owned registry that could identify children by owner and cleanup policy. Terminal sessions therefore had local cleanup only.
Scope
This PR consolidates the tool budget contract, managed child-process contract/registry, and built-in terminal PTY registration. It deliberately does not claim that every shell, LSP, Whisper, extension host, or subagent has been migrated; those are follow-up integrations.
Changes
ToolExecutionBudgetcontract with timeout, output, process, memory, CPU, and network-policy bounds.ManagedChildProcessRegistrysnapshots with duplicate protection, owner filtering, updates, idempotent removal, and drain.Safety
none.Typecheck
Both passed.
Tests
Results: 3 root test files / 10 tests passed; 1 Kun test file / 3 tests passed; lint, build, and diff check passed.
Actual validation
registerTerminalProcesswith a real registry.onExitfor the spawned shell before the watchdog timeout. This is recorded as an external host limitation, not reported as a passing PTY smoke test.Review performed
PR size
Non-goals
Supersedes
Part of the broader runtime resource-governance work; no issue is auto-closed by this PR.