You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(serve): fit provider confirmation answers to the response limit #13038
The Managed Runtime provider worker fits execute, status and cancel results into their per-kind wire budget with fitManagedRuntimeProviderResult, which #12868 added. It does not fit confirmation answers: they are validated and sent as they are, under the same 1 MiB limit.
For a Session that is not preapproved, a write_file or edit over a file of about 900 KB produces a confirmation larger than that limit. The confirmation carries the diff and the original and new contents. The worker route then answers 400 managed_runtime_provider_invalid at confirmation.
The real-stack verification of #12868 measured this (round 6, section 4):
confirm, preflight and start succeed; the result is success; the Session releases
write_file of one line over a 900 KB file
the same
the same
write_file of 200 KB over 200 KB
nowhere (the confirmation is 782 KiB)
success
This predates #12868. That PR kept it out of scope and recorded it as follow-up in its update comment.
What did you expect to happen?
The Harness should get a confirmation it can show for a large edit. Either:
cut the bulk fields (fileDiff, originalContent, newContent) with a notice, the way results are fitted, keeping the fields that each variant requires; or
answer with a definitive, typed refusal that the caller can act on.
Either way, it should not be a protocol-invalid 400 that reads like a malformed answer.
Client information
Not client-specific. It reproduces with the bundled Managed Runtime worker (managed-runtime-provider/1) on main at 1f1209bc70.
Anything else we need to know?
The fitter is fitManagedRuntimeProviderResult in packages/cli/src/serve/managed-runtime-provider-protocol.ts. confirmation is outside its execute/status/cancel set.
Core's serializeManagedToolConfirmation emits each variant's required fields. feat(serve): implement generic Broker provider controls #12868 made the client require them (edit: fileName, filePath, fileDiff, newContent, and originalContent as a string or null). Any fitting has to keep those fields present.
What happened?
The Managed Runtime provider worker fits
execute,statusandcancelresults into their per-kind wire budget withfitManagedRuntimeProviderResult, which #12868 added. It does not fitconfirmationanswers: they are validated and sent as they are, under the same 1 MiB limit.For a Session that is not preapproved, a
write_fileoreditover a file of about 900 KB produces a confirmation larger than that limit. The confirmation carries the diff and the original and new contents. The worker route then answers400 managed_runtime_provider_invalidatconfirmation.The real-stack verification of #12868 measured this (round 6, section 4):
editof a 900 KB fileconfirmationanswers400 managed_runtime_provider_invalidsuccess; the Session releaseswrite_fileof one line over a 900 KB filewrite_fileof 200 KB over 200 KBsuccessThis predates #12868. That PR kept it out of scope and recorded it as follow-up in its update comment.
What did you expect to happen?
The Harness should get a confirmation it can show for a large edit. Either:
fileDiff,originalContent,newContent) with a notice, the way results are fitted, keeping the fields that each variant requires; orEither way, it should not be a protocol-invalid 400 that reads like a malformed answer.
Client information
Not client-specific. It reproduces with the bundled Managed Runtime worker (
managed-runtime-provider/1) onmainat1f1209bc70.Anything else we need to know?
fitManagedRuntimeProviderResultinpackages/cli/src/serve/managed-runtime-provider-protocol.ts.confirmationis outside itsexecute/status/cancelset.serializeManagedToolConfirmationemits each variant's required fields. feat(serve): implement generic Broker provider controls #12868 made the client require them (edit:fileName,filePath,fileDiff,newContent, andoriginalContentas a string or null). Any fitting has to keep those fields present.中文:provider worker 只对 execute/status/cancel 的结果做裁剪,confirmation 不裁剪。未预先批准的 Session 对约 900 KB 的文件做 write_file/edit 时,confirmation 会超出 1 MiB 上限,返回 400 managed_runtime_provider_invalid。这个问题早于 #12868。期望的做法是按变体保留必填字段并裁剪大字段,或者返回一个调用方能处理的明确拒绝。