fix(agent): mark handled tool output final - #721
Conversation
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
| bus.OutboundMetadata{OutboundKind: bus.OutboundKindInterim}.ApplyToContext(outboundCtx) | ||
| kind := "" | ||
| switch { | ||
| case result.ResponseHandled || result.DeliveryIntent == toolshared.DeliveryFinalHandled: |
There was a problem hiding this comment.
Automated review note: This marks every response-handled result final before the delivery route is known. For implicit media without a direct channel-manager route, applySyncToolResultDelivery queues the media and then clears ResponseHandled so the model produces a follow-up answer. The queued media still carries outbound_kind=final, so browser/live consumers can terminate before that later answer arrives. Select the marker using the effective post-route ownership, keeping direct handled media final but queued media that triggers model fallback interim, and assert the metadata in the existing queued-media fallback test.
| bus.OutboundMetadata{OutboundKind: bus.OutboundKindInterim}.ApplyToContext(outboundCtx) | ||
| kind := "" | ||
| switch { | ||
| case result.ResponseHandled || result.DeliveryIntent == toolshared.DeliveryFinalHandled: |
There was a problem hiding this comment.
Automated review note: The final branch runs before DeliveryIntent == immediate_continue. WithResponseHandled().WithImmediateDelivery() is a valid construction that leaves ResponseHandled true while setting the canonical intent to immediate-continue; this code now labels it final even though the turn continues. Before this change, ImmediateDelivery made the output interim. Check a non-empty canonical intent first, then fall back to legacy fields, and preserve interim behavior for legacy conflicts.
|
Automated review by Reviewer agent. Review SummaryThe text path is fixed, but the new final-marker selection can terminate clients too early for queued handled media and for canonical immediate-continue results carrying a stale legacy handled flag. Findings
This marks every response-handled result final before the delivery route is known. For implicit media without a direct channel-manager route,
The final branch runs before |
|
Automated review by Reviewer agent. Review SummaryNo high-confidence issues found. The current head resolves both prior findings: queued implicit handled media is marked interim before model fallback, and canonical immediate-continue intent takes precedence over stale legacy handled state. Prior findings are resolved. The previously reported findings are resolved in the current PR head. |
Summary
Validation
CGO_ENABLED=0 go test -tags goolm,stdjson ./pkg/agent ./pkg/channels/mintclaw ./cmd/mintclaw/internal/agentRegression evidence
A live first-party browser delegation completed its child turn and parent turn, but
mintclaw agent livewaited until its outer timeout because the user-only handled output had no final outbound marker. Tracetrace-turn-4527da22779651f94037e5a7records the child result at +110860ms and parent end at +110982ms.