Skip to content
Directory
GitHub Star
Evidence, tags & source code

Making Agent Errors Correctable: Critical Thinking and Harness Engineering ​

When an agent can find sources, write code, run tests, and return a well-organized completion report, it is easy to reduce our own role to one final confirmation.

But what is that confirmation based on? The model says it has finished, the tests are green, and the run log contains no exceptions. How much does each of those observations actually tell us? If the conclusion is wrong, does the system have a chance to discover that—and the means to correct it?

Two articles I read recently prompted me to revisit some lessons from developing ETF Agent.

In “Critical thinking when agents do the work” (readable English mirror), Addy Osmani argues that we can delegate execution and much of the review to agents while still understanding the basis of important judgments and what the checks leave uncovered. We need to maintain a deliberate boundary between delegating work and handing over responsibility.

Trackmind's “Harness Engineering: How to Fix Your Agent Without Changing the Model” (readable English mirror) turns attention to the environment around the model. Task contracts, tools, state, checks, stopping conditions, and permissions all affect whether an agent can finish its work. The article also acknowledges real limits in model capability and advocates adding supporting mechanisms incrementally, in response to actual failures.

Here, harness means the whole environment that enables the model to work. Runtime is the part responsible for admitting actions, executing them, and recording the facts of a run. Neither term necessarily implies a new framework or a separate process.

Reading the two together, and comparing them with our experience, brings me to a question about how they connect: How can a person's doubts become differences a system can observe and handle? And how can the differences it discovers actually change the next action?

With only the first half, we keep telling the model to “be more careful.” With only the second, and nobody examining the goal or the criteria, we may build a system that rigorously enforces the wrong standard. Giving an agent a chance to correct itself requires connecting both halves. The checks and constraints themselves must also be open to examination.

First, define what we want the agent to correct ​

Consider a teaching example. A user asks a research agent whether investing new money in a particular fund would help reduce the portfolio's concentration in an asset category. The user also wants a report they can review afterward.

Suppose the original portfolio is worth CNY 1,000,000, with CNY 400,000 of exposure to asset category X. The new contribution is CNY 200,000, and category X accounts for 25% of the candidate fund. Ignore price changes and fees for now. Assume consistent amounts, asset classifications, and valuation conventions, and include the new money in total portfolio assets.

Scenario being comparedTotal portfolio assetsExposure to category XCategory X as a share of the portfolio
Before the new contributionCNY 1,000,000CNY 400,00040%
After the contribution, with all new money held as cashCNY 1,200,000CNY 400,00033.33%
All new money invested in the candidate fundCNY 1,200,000CNY 450,00037.50%

Compared only with the original 40%, the model could write that concentration has fallen. But if the user is comparing holding the new money as cash with buying the fund, the share after buying is higher than 33.33%. Absolute exposure also rises from CNY 400,000 to CNY 450,000. These numbers do not contradict one another; they answer different questions. Nor do they establish that overall risk has fallen, since we have not analyzed correlations between assets, other risks, or the user's objectives.

Asking a calculation tool to run the numbers again can check the division. Asking another model to make the paragraph more precise can improve the wording. Neither can decide for us what the user actually intends to compare.

At the start of a task, it is therefore worth clarifying the few conditions that could change the judgment: which two alternatives are being compared, which date and measurement conventions apply, what missing information would require a conditional conclusion, and what the final deliverable should be.

These conditions do not all need new fields. A clear paragraph may be sufficient for an ordinary task. Stable, recurring calculations can go into existing tools. More involved research methods can become a Skill loaded when needed. Only boundaries that the system genuinely needs to enforce should become the corresponding code checks.

For example, “do not exercise trading permissions” requires actual permission isolation. “Use a consistent denominator for the same asset-share measure” can be expressed in calculation inputs and tests. “Does this comparison serve the user's purpose?” still requires judgment in context. Putting all three into a universal completion validator would blur what each can establish.

This is the most practical meaning of critical thinking for me: before accepting a conclusion, know which change in its premises would make you revise it, and have a way to observe that premise.

Correction starts with an accurate account of what happened ​

A clear goal still needs trustworthy feedback. If the model receives an inaccurate account of execution, even careful reasoning may lead it to choose the wrong remedy.

In September 2026, one ETF Agent development diagnostic labeled its final failure PROVIDER_UNAVAILABLE. Following that label would naturally lead us to investigate the provider, the network, or upstream rate limiting.

Looking back through the run showed that the exhausted allowance belonged to the local diagnostic proxy. An HTTP 429 carrying a local-limit marker had been classified along the call chain as provider rate limiting and a retryable transport failure. A model call made before research began also exposed inconsistent accounting of the total allowance at two counting points.

The same status code can describe different facts. A temporary upstream rate limit might justify a bounded wait. If the current run has used its entire allowance, waiting does not automatically create another permitted call. Telling the model that the latter situation means “the service is temporarily unavailable” deprives it of the information needed to choose the right next step.

In another diagnostic, the model tried to read material using a handle that search had recently returned, only to receive INVALID_SOURCE. A handle is a controlled entry point the system issues to the current task. That error alone does not establish that the model invented a source.

Inspecting the configuration at the time made the problem more concrete. A research run could last 90 seconds, but its source handles expired independently after 60 seconds. Up to 12 searches with up to 10 results each could require 120 registered handles, while the registry had room for only 50. There was also a path that returned results to the model even when their registration had failed.

Each limit could seem reasonable in isolation. Together, they could create a contradiction: the system allowed research to continue and handed out source entry points, then refused reads through the very entry points it had issued.

The original record confirms that both rejected handles had appeared in search results consumed by the model. It does not establish whether each handle failed because of expiry or capacity. That run also had mismatched publication references, so the incomplete delivery cannot be attributed entirely to the handles.

The change prompted by these diagnostics was to correct error attribution and constraints across layers before deciding how the model should behave. See the budget and constraint governance retrospective for the details. These were development observations from different versions, not a comparison of success rates under identical conditions.

Returning to the research example: if the material does not exist, the agent should retain that uncertainty. If it exists but access is restricted, the agent should explain the scope of that restriction. If a legitimate entry point issued by the system stops working, the mechanism needs repair. Flattening all three into “nothing was found” removes information that both the model and the developer need to make decisions.

Finding a problem is not enough; leave room to correct it ​

Accurate feedback does not ensure that correction can happen.

Another historical diagnostic reached the end of research and attempted to submit an answer. The submission was rejected, but too little model-request allowance remained to read the rejection, revise the answer, and submit it again.

The system was not retrying indefinitely, and its budget protection was enforcing the limit. The problem was that it had used its resources until no path to finishing remained.

The subsequent change reserved space within the same total budget for delivery, necessary corrections, and finishing. Exploration could no longer consume that portion. Recovery and retries could not reset the amount already spent. The model still judged whether the evidence was sufficient; the host explained which actions remained permitted.

The difference between exhausting exploration resources and reserving room to finish within the same total budget

Figure 1: A teaching illustration. Reserving resources for finishing gives correction a chance to happen. It neither increases the total allowance nor guarantees task completion. Open the full diagram

One reserved attempt can itself be consumed by a failed submission. Even with more room to correct an answer, the result may still be partial. What we can claim here is that the system preserves a permitted path to finishing. This does not establish an improvement in research quality or success rate.

Delivery needs another supporting property: work already achieved should have its own facts about persistence and retrieval.

While developing answer publication and recovery, we handled a failure window in which the answer text had committed but the run log had not yet caught up. If recovery trusted only the run log, a saved answer could disappear from the user's view. A separate problem arose when comparing the same revision: a temporary preview could mask the source status carried by the committed receipt.

Addressing these problems requires the committed publication record to own the facts about text and versions. Clients must distinguish temporary previews from committed results, and recovery must read saved content back. A later failure should not automatically erase valid work that has already committed. An attachment failure can be presented locally; if the conclusion depends on an attachment that has not been obtained, the report should explain the gap rather than pretend to be complete. That is a judgment about delivery completeness, not a new gate for deleting the answer text. The answer publication system explains the mechanism in more detail.

The public Open ETF Agent publication tests offer a smaller point of comparison: preparing content does not create a committed revision, a transaction failure must roll back, and a later run failure preserves the earlier commit receipt. They cover a bounded implementation with one answer body and SQLite. They do not represent every preview and recovery path in the full system.

A report having been generated, having been saved, and being available for the user to reopen therefore need separate observations. Without that distinction, an agent may repeatedly regenerate content that already exists, or mistake a normal termination for proof that the user received the result.

The environment that makes correction possible must provide accurate feedback, preserve a reasonable next step, and retain work already achieved.

A check can turn red while measuring the wrong thing ​

At this point, it is tempting to add more tests and more review. But checks have assumptions of their own.

A model-format evaluation in September 2026 once reported failures for all 10 models. Reviewing the original outputs revealed a problem in the test fixture's conventions for multiline markers and output formatting. The Skill invocation and internal timeout configuration also needed correction. After those changes, a targeted retest produced 9 passes, while retaining 1 actual formatting violation.

The conditions changed, and new calls were made. This cannot be described as rescoring the same outputs, and the two sets of numbers cannot be read as an improvement in model capability. The useful lesson is that an evaluator can run normally and produce scores consistently while misunderstanding the task.

In this case, the checks could certainly turn red, and they did so comprehensively. What was missing was an examination of why they had turned red.

Green results carry the same risk. Suppose both the implementation and its tests adopt “the asset share after investing the new money is lower than in the old portfolio” as their only criterion. They can pass together while both missing the comparison the user actually cares about.

I would therefore take the check one step further: Would it produce a different result when confronted with the kind of error we are worried about?

Problem we want to detectDifference worth observing
The comparison baseline has changedHold other inputs fixed and change the alternative being compared. The report must identify its baseline, and the conclusion should respond to the relevant change in conditions.
A source entry point issued by the system cannot be usedWithin the agreed time and capacity limits, a registered entry point remains resolvable and can enter the permitted reading process. Report upstream reading failures separately.
Saved text disappears after recoveryInterrupt the process after commit but before the run log updates. Reopening should still retrieve that fixed revision of the answer text.
The scorer misunderstands the formatting requirementsManually checked valid and invalid examples receive their corresponding results, and boundary inputs are judged under the same convention.

This table distills validation methods from the cases. It does not mean that every row has undergone a complete evaluation with real models. Its value is to turn “add more testing” into an executable observation that could also disprove the current design.

That is why original outputs, task statements, versions, and scoring rules are worth preserving. When a conclusion changes, we need to distinguish a change in the model from a change in the input, the operating conditions, or the measure used to judge it.

A harness also needs simplification ​

Interpreting these lessons as “permanently add a new gate whenever a problem appears” leads to another difficulty.

We once required the model to describe actions, gaps, and completion status in a fairly heavy structure. The runtime already held the execution records, yet the model also had to maintain its own account of execution. Whenever the two disagreed, we had to decide which account represented the facts. The protocol also pulled the model's attention toward maintaining that account.

We later moved to a native tool-calling loop. The model proposes the next action, the tools and runtime return actual execution results, and the model uses those results to continue reasoning. Working notes can support research, but they cannot replace permissions, budgets, tool receipts, or committed publication records. The boundary between the model and the execution protocol explains the choices behind that simplification.

This reduces the burden of describing execution state twice while retaining the protections execution needs. A smaller protocol does not establish a smarter model, and improved model capability does not justify removing permission checks.

In “Harness design for long-running application development”, Anthropic also describes calibrating a review agent and then removing supporting structures one at a time. As models and task conditions change, structures that once helped can become additional burdens. That is a useful method of iteration, but it is not evidence of benefits in our own system.

For our designs, an extra check should answer two questions: which specific error does it prevent, and what burden does it add to normal tasks? An additional piece of state also needs to answer whether it stores a new fact or duplicates information another module already holds.

If a user only needs one field from a clearly identified source, the existing reading tool, source marker, and result display may be enough. There is no need to add multiple experts, a long plan, or independent review by default. Add further review in response to the actual gaps in a complex comparison, ambiguous premises, or an output with significant consequences.

Removing an added mechanism also needs evidence. Keep the example that exposed the original problem. Compare quality, delivery, latency, and cost using the same tasks and criteria, and confirm that the original protections still have the right owner. A model upgrade is a reason to reassess those mechanisms, not an automatic reason to remove every constraint.

Connect correction within a run to correction of the system ​

Placed back into a working process, these lessons reveal two distinct kinds of correction.

The first happens within the current task. The model reads new material, discovers that the comparison uses a different basis, and withdraws an inference. A tool reports a specific gap, so the model uses another permitted source or delivers an answer with explicit limitations. These adjustments remain within the original authorization and total budget.

The second happens during engineering iteration. Developers discover that a local allowance was misreported as a provider failure, that a source handle's lifetime does not match the task deadline, or that an evaluator rejected a correct output. They then change the relevant module, test fixture, or task contract, validate the change, and use it in subsequent runs.

How bounded correction within a task connects to developer-led correction of the mechanism

Figure 2: The two kinds of correction connect through execution facts and validated changes. The engineering feedback shown here does not let an agent expand its own permissions, reset its budget, or rewrite acceptance criteria. Open the full diagram

This distinction determines what to do after a failure.

If the model uses the wrong denominator, first bring it back to the facts and the calculation. If a tool returns the wrong date, correct the data or the tool contract. If a task is within the original contract but conflicting constraints remove its path to completion, correct the relevant mechanism. If the criteria measure the wrong thing, calibrate them before evaluating the model. When a task really exceeds its authorization or available resources, stopping and explaining the boundary can also be the correct outcome.

An agent can point out these problems during a run. It can also propose patches as part of an authorized development task. But the desire to pass does not automatically give it authority to change permission boundaries or acceptance criteria. Otherwise, “correcting an error” can easily become “making the error message disappear.”

The human role becomes more concrete as well: decide what is worth solving, which consequences are acceptable, what evidence is still missing, and where to put judgments that have become stable. Execution, recalculation, finding counterexamples, and much of the review can still be delegated to tools and models. People do not need to redo all the work.

Start with the next failure and change one real path ​

To apply these ideas to an existing agent, I would begin with one representative failure record and trace where the opportunity to correct it was lost.

If the model did not receive a crucial fact, repair the source or the context handoff. If it received the fact but misunderstood it, examine the task wording, research method, and model capability. If an error was identified but no permitted action or finishing resources remained, examine the tools and runtime constraints. If a report committed but could not be reopened, repair delivery and retrieval.

Then choose an example that exposes the problem, make the smallest change in the component responsible, and observe the result along the original user path. Put what can be expressed as deterministic rules into code. Where open-ended meaning matters, use the original material, counterexamples, and independent review when needed. A passing local check is not a basis for declaring the entire task successful.

Returning to the portfolio research example, the outcome we want is a report with an explicit comparison baseline, consistent data conventions, and stated unknowns. Its calculations can be checked, and its result can be reopened. When a new fact overturns one of its judgments, the agent can revise it. When the system obstructs that revision, developers can locate and change the mechanism responsible.

This does not promise that agents will stop making mistakes. It gives our attention a concrete focus: Can important judgments be challenged? Can real feedback reach the next step? Can an identified problem be corrected within reasonable boundaries?

Critical thinking supplies the judgment about why to question something and what is worth changing. The harness turns the parts suitable for engineering into observable, executable working conditions. Keeping the two calibrated against each other is the direction in agent engineering I want to invest in.

Engineering notes, evidence and boundaries. · Contact: hpoenixf@foxmail.com · WeChat: hpoenixf0510