Repository navigation
Conversation
agentBroken returned false as soon as any job had completed, on the theory that a completed scenario proves the agent works. It proves the agent worked until then: when the CLI-spawned agent dies or wedges mid-run, every remaining job waits 30s for an agent, retries, and fails with "No agent joined room", and the run keeps going. That was 1,202 failed jobs across 175 runs in a week. Count only the join failures that ended after the last completed job, so a mid-run death cancels the run and surfaces the agent's log like a startup crash does, while timeouts before or between successes stay tolerated.
Contributor
Author
|
With this PR, killing the spawned agent after its first job cancels the run after 4 join failures ("The agent is failing to run jobs; cancelling the run."), and the unrun jobs stay pending instead of each failing with "No agent joined room". agent-dies.mp4 |
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.
When the agent under test dies or wedges partway through
lk agent simulate, the run keeps going. Every remaining job waits 30s for an agent, retries in a fresh room, waits again, and fails withNo agent joined room … Is the agent running?. The user burns quota and waits minutes for a run that cannot succeed, then reads a report blaming each scenario.The cause is the broken-agent check.
agentBrokenreturnedfalseas soon as any job had completed, on the premise that "a completed scenario proves the agent works". It only proves the agent worked until that scenario ended. The check now counts only theNo agent joined roomfailures that ended after the last completed job, so a mid-run death or wedge is handled like a startup crash: the run is cancelled and the agent's log is surfaced. Timeouts before the first success (cold start) or between successes are still tolerated. Because the check reads job outcomes rather than the local process, it covers a wedged-but-alive agent and live--agent-nameruns too.Production, last 7 days: this "worked, then every later job failed" pattern was 175 CLI-spawned runs with 1,202 failed jobs, about 47% of all
No agent joined roomfailures. Another 31 live--agent-nameruns (145 jobs) had the same pattern; 127 of the 175 CLI runs were never cancelled.Repro: starter Python agent, CI mode,
lk agent simulate text --scenarios scenarios.yaml --samples 3 --concurrency 1 --yes, then SIGKILL the spawned agent once the first job finishes.No agent joined room.The agent is failing to run jobs; cancelling the run., cancelled the 4 jobs not yet run, and exited 1 at 329s.Tests:
TestAgentBrokentable tests; the "agent died after working" case fails on main.go test ./cmd/lk/passes.A follow-up stacked on this branch adds a faster trip when the local agent process has exited.