Skip to main content

DeepSeek Harness: A Recorded Tool Call Is Not an Execution

Updated 4 min readMarkdown

A tool call being recorded is not evidence that the tool body ran. In DeepSeek Harness the call is logged before execution, then passes through policy, approval and guards before anything is dispatched — and what the model finally sees can differ from what the tool returned. This is the short version of a longer walkthrough of that pipeline.

The symptom

You are reading a session log, you see a tool/call event, and you conclude the operation happened. Or you see a completed card in the UI with a result in it, and you conclude the operation succeeded as written.

Both readings skip the stages in between. The session records tool/call before tools/pre-execute runs, and the UI can show a pending card from presentCall(args) while nothing has executed yet. A recorded request, a pending card, and a completed card are three different claims about the world.

The same confusion shows up from the other direction: a result that looks wrong and gets blamed on the model, when a projection, post-execution or finalization step rewrote the content after the tool body had already returned.

Three things to check, in order

  1. Did the body run at all? Pre-execution is a waterfall — a listener chain that can transform or short-circuit the call — used for hooks, permission and sandbox policy. Three paths leave it: allow proceeds to the registered guards, deny skips the tool body, ask goes to the approval service. A denied call still goes through result processing, so a recorded outcome does not mean an execution.

  2. Did the approval actually settle the question? An allowed one-shot approval is not the final decision. Registered monotonic guards run afterwards and can still deny, and the approval service's own callers deny unless the outcome is allowed-once. The approval audit events (approval/asked and approval/decided) are log-only; the model sees the caller's derived tool result instead. An approval is also specific to the action that was asked about, not a standing grant for later calls.

  3. Did the result get rewritten before the model saw it? The tool definition's projectContent installs execution-prepared text and images before tools/post-execute, which can accept, block, replace or add context. Then finalizeContent enforces its final content-only invariant, tools/result observes the frozen outcome, and a tool/result session event records the single model-facing outcome. Raw body output and eventual content are allowed to differ.

Why denial and execution error look alike

Both can end as an error-shaped, model-facing result. But the reference explicitly routes a denial to result processing without entering the body, while a wrapper or body can throw after dispatch has begun and the registry normalizes that too. The error outcome alone cannot tell you how far the operation got — which matters a great deal before you decide to retry a call with external or irreversible effects.

The same caution applies to a completed UI card. It presents the recorded session result; it is not a separate execution stage and not a complete trace of every policy listener that may have touched the content.

What none of this proves

A policy gate, a sandbox setting, a successful result or an approval does not establish that an operation is safe. The pipeline documents ordering and extension points, not any plugin's configuration and not an exact timing guarantee. And tool call arguments can carry private paths or credentials, so sanitize anything you intend to share.

The full write-up covers the stage-by-stage table, how PTC transport records relate to individual sub-calls, what to capture when investigating a single call, and where each of these boundaries sits in the graph: DeepSeek Harness: Tool Calls to Results

A recorded call passes policy and guards before dispatch and final result processing

Originally published at https://dsh-plugin.com/blog/model-tool-call-execution-flow

No comments yet. Be the first to comment.

More from this blog