Skip to content

fix(serve): fit provider confirmation answers to the response limit #13038

Description

@wenshao

What happened?

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):

Call Where it stops Afterwards
edit of a 900 KB file confirmation answers 400 managed_runtime_provider_invalid 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.

中文:provider worker 只对 execute/status/cancel 的结果做裁剪,confirmation 不裁剪。未预先批准的 Session 对约 900 KB 的文件做 write_file/edit 时,confirmation 会超出 1 MiB 上限,返回 400 managed_runtime_provider_invalid。这个问题早于 #12868。期望的做法是按变体保留必填字段并裁剪大字段,或者返回一个调用方能处理的明确拒绝。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category/cliCommand line interface and interactiondaemonpriority/P2Medium - Moderately impactful, noticeable problemscope/clistatus/ready-for-humanSpecified but requires human judgment to implement; not suitable for an autonomous agenttype/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions