fix(pi): stop an unproductive nudge loop, and name every agent abort - #1273
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The pi completion guard re-prompted while tasks stayed open without checking that a nudge produced anything. A model that returns with no tool call and no text drains all 20 nudges in seconds, so the run aborts with INCOMPLETE_TASKS and no work done. Stop on the first dead nudge and space live ones out. The `agent aborted` event also fired for runs that completed without an SDK success result, and named no failure mode on either the anthropic or the linear path. Emit it only for a run that failed, and always with the mode. A gateway mint refusal reached the handoff screen with its message dropped, so a user out of runs read only that the wizard was busy. Show the refusal reason there. Generated-By: PostHog Desktop Task-Id: 437bbb5a-d0c5-4b72-aaa9-9eff3b08e32c
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PHW_AGENT_INCOMPLETE_TASKSwith no work done.agent abortedcannot tell us how large that slice is: over the last 14 days, 296 of 303 events carried no reason at all.agent completed.Changes
NUDGE_BACKOFF_MSbetween live nudgesagent aborted(anthropic)failure_modeagent aborted(linear)failure_modeagent incomplete tasksopen_tasksonlynudgesanddead_nudge, so the dead-nudge slice is separablenudgeWhileUnfinishedin completion.ts, next tocompletionFailure, so the loop's caller keeps only its counters.runErrorTypemoves to signals.ts, besideAgentErrorType, because the anthropic path now classifies its rethrow on the same rule as pi.Note
Abort counts will drop on merge, and most of the drop is the false positives leaving, not runs getting better. Read the new
failure_modebreakdown, not the raw count, across the change.Test plan
src/lib/agent/runner/harness/pi/__tests__/completion.test.ts: a dead nudge stops after one send, live nudges continue, the cap holds, a finished run sends nothing, and live nudges wait.src/ui/__tests__/mint-failure.test.ts: the refusal reason appears for both gateway codes and for nothing else.LLM context
Written by PostHog Desktop from the linked inbox report. Considered and rejected: lowering
MAX_CONTINUE_NUDGES, which caps the damage of a dead loop but still burns the cap and still aborts a run that only needed one more live nudge. The same guard intask.tsis capped at 3 and was left alone.Created with PostHog Desktop from this inbox report.