Repository navigation
refactor(runtime): collapse redundant tool call argument views - #4971
Conversation
4a6b357 to
ef9da46
Compare
66f2b36 to
36feaa7
Compare
Why this extraction existsThis change is not intended to create four independently transformed or redacted copies of every tool argument. The four names describe different consumers of the same call data:
For ordinary tools these values may be identical. They diverge when a tool has a permission projection, and Computer Use additionally applies its existing privacy and accepted-field-name projection before persistence/model replay. The extraction gives that existing relationship one internal owner. Previously it lived inline in A separate module is used because this is a pure data boundary with no This is also intentionally independent of #4879. It does not change Measured production change: |
|
@Astro-Han could you please review this specifically against the direction of #4879? The intended boundary is entirely before transcript publication: it extracts the existing argument snapshot, declared validation, permission projection and persisted/model-facing projection, while leaving |
36feaa7 to
1f2cecd
Compare
Merge main with RuntimeEvent-only transcript support. Remove unused exports and intermediate aliases while retaining the distinct argument roles. Generated-by: OpenAI Codex
|
Automated follow-up by OpenAI Codex on behalf of testikun (not an independent human review). Merged main containing #4879; the RuntimeEvent-only transcript dependency is no longer pending. Full build:test, full typecheck and lint pass. 95 focused ToolRuntime/SQLite/model-history tests pass; full Runtime suite: 3,349 passed, 13 skipped, 0 failed. Simplification retained after verification: removed unused exported implementation types/helper and redundant intermediate aliases. Admission, persistence and lifecycle ownership remain in ToolRuntime. Please review the latest head. |
Withdrawing my approval pending the overall simplification assessment explained in the follow-up review. Behavior preservation alone does not establish the value of this extraction.
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for explaining the boundary and doing the verification. I want to correct my earlier approval: I checked behavior preservation, but gave too much weight to making tool-runtime.ts smaller and not enough to whether the repository becomes simpler overall. That was my mistake.
For this refactor, I would like the acceptance criterion to be a reduction in overall complexity: fewer duplicated rules, concepts, intermediate representations, layers, and maintenance points. Moving an already centralized implementation into another file and adding input/output interfaces does not, by itself, meet that goal. Line count is a useful signal, not the sole criterion, but the current net growth needs a concrete simplification benefit beyond a smaller source file.
I am comfortable with a larger PR or a broader refactor if it removes the underlying complexity coherently. I would prefer that over a small extraction that leaves the same responsibilities in place and adds another interface to maintain. This is not a request to split the work into more wrappers or facade layers.
Could you revisit the scope with that goal? Start from the smallest complete argument-processing path, remove unnecessary pass-through fields and redundant representations where the actual consumers allow it, and show which rules or maintenance points disappear. Keep the execution/permission/privacy contracts and the existing regression coverage. If the extraction cannot demonstrate that tradeoff, keeping the logic in place is a reasonable outcome too.
I am withdrawing my approval for a87f1b263 while that design question is revisited. The earlier behavior checks still stand; this is a correction to my assessment of the refactor's value, not a newly discovered runtime defect. Thanks for taking another look.
中文
我想纠正之前的批准:我确认了行为保持,但过于看重单个文件缩短,没有充分判断仓库整体是否更简单,这是我的判断失误。
我希望重构减少重复规则、概念、中间表示、层级和维护点。可以接受更大规模的 PR 和重构,只要它连贯地消除原有复杂度;不能仅把已有集中逻辑搬走,再增加输入输出接口。行数不是唯一指标,但净增长必须换来具体收益。
请按这个目标重新考虑范围,保留执行、权限和隐私契约,删去没有必要的透传和重复表示,说明最终消除了哪些维护点。如果抽取本身无法带来这样的收益,保留原地实现也可以。我会撤回当前批准,待设计取舍重新收敛后复审;这不是新发现的运行时缺陷。
me2seeks
left a comment
There was a problem hiding this comment.
Reviewed exact head 8802b8454fb3cf12c3303caae3a5e8f72538bff0. This revision removes the earlier extraction layer and now makes a small behavior-preserving simplification: the two removed aliases were definitionally identical to their surviving values, while synchronous input snapshotting, schema validation, permission projection, Computer Use privacy projection, admission, durability, and replay boundaries remain unchanged. Exact-head test is green, the PR is mergeable, and there are no review threads.
Astro-Han
left a comment
There was a problem hiding this comment.
Approved at 8802b84. The revised scope is the right call — collapsing modelFacingArgs into persistedArgs removes a dead alias instead of adding a layer, and the snapshot/clone semantics are unchanged (structuredClone(input.persistedArgs) is the same value the removed field carried). The remaining modelFacingArgs in computer-use-tools.ts is a separate debug-record field, not a dangling reference. Clean.
Refs #4908
Refs #4909
Summary
ToolRuntime, its single lifecycle owner.executionArgsinstead of creating and returning a second alias.persistedArgsvalue for both durable recording and model replay, removing the always-identicalmodelFacingArgspass-through.tool-call-snapshot.tsmodule, its input/output interfaces, and its admission-state booleans.This revises the scope in response to review. The previous extraction made one file shorter but increased repository-wide concepts and maintenance points. The current diff instead removes one redundant representation and one drift point without adding a layer.
Behavior preserved
ToolRuntime.Measurements
Relative to current main (
4410c3a2d):packages/runtime/src/tool-runtime.ts+8/-42(net -34 production lines)tool-runtime.ts: 3,600 -> 3,566 linesVerification
Using Node 24.20.0:
npm ciwith repository dependency patches applied and 0 audit vulnerabilitiesnpm run build:testgit diff --check upstream/main...HEADAI use
OpenAI Codex performed the synchronization, scope revision, implementation, and local verification. The contributor remains responsible for review and submission.