A Successful Tool Call Can Still Miss the UI Deadline
An agent renames an event. The tool returns success. A background refresh eventually displays the new title. If the user-facing operation promised that the updated title would be visible before completion, did the operat
An agent renames an event. The tool returns success. A background refresh eventually displays the new title. If the user-facing operation promised that the updated title would be visible before completion, did the operation succeed?
Checking only the final page can answer the wrong question. A later repair may produce the correct state while hiding the fact that the state was wrong at the moment the application declared completion.
The companion example models that distinction with ordinary TypeScript snapshots. It is inspired by the effect-checking work in Trip Workbench, but it does not require an observability package or claim a new kind of assertion. The important decision is when to observe and what evidence to preserve.
Separate a command result from its promised effect
A callback result establishes something about the callback. It might mean validation passed, a server accepted a mutation, or a store update was requested. None of those facts necessarily proves that the intended UI now reflects the accepted change.
For a rename operation, define the expected effect as a concrete snapshot:
const expected = {
resourceId: "event-lab",
revision: 8,
title: "Winter meetup",
};
The resource identity prevents a matching title on another event from satisfying the check. The revision distinguishes the accepted update from an older state with coincidentally identical text. The title represents the user-visible field we intend to observe.
Declare expected resource and field values from the requested intent before execution. Derive the expected revision from known prior state and documented mutation semantics, then compare the receipt as a separate application claim. The fixture uses synthetic values so the observation rules are easy to inspect.
Define the deadline as an application event
βEventually correctβ and βcorrect when the operation completesβ are different product contracts. Neither should be smuggled into a test through an arbitrary sleep.
Choose an explicit deadline: for example, the point where the application emits its completion event after the view has committed the accepted revision. Then collect the relevant observation at that boundary.
This does not mean every render must finish synchronously inside a tool callback. It means the application must define what its completion signal promises. If the product intentionally supports eventual consistency, expose that state and test the allowed transition instead of declaring premature success.
Preserve observations instead of rewriting them
The example stores each observation with its phase, expected value, actual value, timestamp, and verdict. It copies the snapshot when recording it so a later mutation cannot rewrite the historical evidence.
type Verdict = "passed" | "failed" | "unknown";
type Observation = {
phase: "deadline" | "after-repair";
verdict: Verdict;
expected: Snapshot;
actual: Snapshot | null;
observedAt: number;
};
A missing observation is unknown. A known mismatch is failed. A matching resource, revision, and title is passed.
That third state matters. If the selector disappeared, the observer was unavailable, or the read never happened, treating the absence as success makes the evidence look stronger precisely when visibility is weakest. The fixture's deadline decision treats unknown as nonpassing while preserving its distinct meaning in the record.
Let repair add evidence without erasing failure
Suppose the deadline observation sees revision seven and the old title. A later refresh sees revision eight and the new title. Store both records.
The deadline verdict remains failed. The after-repair observation explains that the system recovered, which is useful operational information, but it does not change what happened at the promised completion boundary.
The decision function is deliberately small:
function deadlinePassed(records: Observation[]) {
const deadline = records.filter(r => r.phase === "deadline");
return deadline.length > 0 &&
deadline.every(r => r.verdict === "passed");
}
The nonempty check prevents a collection containing only after-repair observations from implying a successful deadline. In a larger application, also define the required observer set; checking every recorded observer is insufficient if a required one never produced a record.
The miniature fixture has one required snapshot, so it makes that assumption explicit rather than presenting the function as a complete distributed verification system.
Test the evidence rules before integrating observers
Six companion tests passed locally. They cover a healthy deadline, a later repair that cannot erase failure, a missing observation, the wrong resource, an after-repair-only record, and preservation of historical snapshot values.
These are deterministic tests of evidence semantics. They do not prove that a browser DOM or database observer reads the correct source. An integration test must exercise those sources at the intended boundary.
The distinction also clarifies what an observability library contributes. A well-timed plain assertion can catch the same mismatch. An operation-level record adds correlation, history, and a consistent place to inspect several observations. It does not make a weak assertion stronger by naming it an effect check.
Combine this with agent evaluations carefully
the pinned WebMCP Evals simulation mode can check final DOM assertions after a conversation. That is useful for assessing the final outcome of an agent workflow.
A final DOM read and an operation deadline are different observation points. If a conversation continues after a failed update and the page repairs itself, the final-state assertion may pass correctly for its stated purpose. It cannot, by itself, recover an earlier observation that was never recorded.
Use both when the product needs both guarantees: a final user-goal check for the conversation and a deadline observation for each consequential operation. Keep their names and results distinct in reports.
Bring the pattern into a real event workflow
For Trip Workbench, a practical integration starts with one mutation and one visible field. Correlate the accepted operation with an event identifier and revision. Observe the intended view at the defined completion boundary. If a background refresh repairs the state, append an after-repair observation under the same operation.
The package includes a manual integration checklist rather than claiming that this article reran the repository's native browser workflow. Its portable tests establish the bookkeeping rules; the application run establishes whether the observers are connected correctly.
This produces a more useful debugging question than βDid the agent succeed?β You can ask whether the command was accepted, whether the intended effect existed on time, and whether recovery happened later. Each answer points to a different part of the system.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.