Repository navigation
Description
Summary
Mecatl already records a content-free request.manifest before each provider call. It records the final advertised tool names, prompt component sizes, message count, and encoded message size.
It does not record the total size of the tool schemas actually advertised to the model. That forces incident investigations to reconstruct a request with a mock server just to answer a basic question such as:
Did this turn send 25 tools whose schemas occupied 38 KB?
Add that one exact, content-free measurement and fix the manifest enumeration path so the evidence describes the same tool snapshot that the provider received.
Tracking: #1639
This issue is diagnostic follow-up work only. It does not close or resolve #1639.
Current behavior
Engine.buildRequest constructs the final port.LLMRequest, then compaction may adjust its history suffix. emitRequestManifest emits the existing manifest immediately before LLM.Stream receives that final request.
The current manifest records:
- provider/model/reasoning-effort identifiers;
- context window;
- advertised tool names and advertisement decisions;
- message count and encoded message bytes; and
- system/instruction component provenance and sizes.
See engine/agent/loop.go, engine/agent/request_manifest.go, and engine/session/event.go.
Problem
While generating tool-decision evidence, requestToolDecisions calls Tool.Spec() again during catalog enumeration.
A tool specification can refresh live state. The diagnostic path can therefore:
- construct a request using one tool specification;
- ask the tool for its specification again while preparing evidence; and
- record a later state rather than the request snapshot sent to the provider.
It also violates the catalog metadata rule: ordering and filtering must use catalog registration keys, not repeated Tool.Spec() calls.
Proposed behavior
-
Enumerate catalog tools for manifest decisions using registration-key metadata.
-
Preserve live
Spec()calls only at actual tool-advertisement boundaries. -
Add this field to
session.RequestManifestPayload:advertised_tool_schema_bytes -
Define it exactly as:
The sum of
len(spec.Schema)for every finalreq.Toolsentry handed to the provider after mode, authority, overlay, progressive-disclosure, and shell-availability filtering. -
Expose the number through the existing target-bound
InspectSessionmanifest view.
Privacy and scope
The new field is an integer only. This issue must not add:
- tool-schema text or descriptions;
- prompt/message/tool-result content;
- tool arguments;
- response content;
- URLs, headers, cookies, credentials, or provider IDs beyond existing safe fields;
- hashes/digests of those values;
- a new CLI/configuration option; or
- a normal live-client or public event-log projection.
The event remains durable-evidence/debugger-only, consistent with the existing request.manifest contract.
Acceptance criteria
- Manifest generation adds no
Tool.Spec()calls beyond those needed to form the provider request. -
advertised_tool_schema_bytesequals the schema-byte sum of the final provider-observedreq.Tools. - Mode, authority, overlay, progressive-disclosure, and shell-less filtering are reflected in the reported total.
- Existing no-content guarantees still hold with schema/prompt secret canaries.
- The number is durable and visible through the existing debugger manifest projection, but absent from ordinary client event streams.
- Engine API compatibility artifacts and changelog classification are updated.
Work classification
Bounded. This extends existing content-free request-manifest evidence without changing its authority, retention, visibility, or raw-content boundary.
Activity