open-code-review/internal/agent
Fanzzzd 4b6874bd23
Some checks failed
CI / cross-compile (amd64, darwin) (push) Has been cancelled
CI / cross-compile (amd64, windows) (push) Has been cancelled
CI / test (push) Has been cancelled
CI / windows (push) Has been cancelled
CI / cross-compile (arm64, darwin) (push) Has been cancelled
CI / cross-compile (arm64, linux) (push) Has been cancelled
CI / cross-compile (arm64, windows) (push) Has been cancelled
CodeQL Advanced / Analyze (go) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Pages / build (push) Has been cancelled
Deploy Pages / deploy (push) Has been cancelled
fix(agent): name the main-loop stop trigger in item failure reasons (#855)
* fix(agent): name the main-loop stop trigger in item failure reasons

StopEmptyRounds and StopCompression previously collapsed into the same
"main task stopped before completing" string as StopNone, so a failed
item's manifest could not say whether the model spun without usable tool
results or the context outgrew its compression threshold. In --format
json runs the progress lines that name the trigger are discarded, which
made the manifest reason the only diagnostic that leaves a CI runner —
and it said the same thing for every stop.

Keep the unknown failure class (the taxonomy has no fitting category)
but give each stop its own reason, mirroring the StopMaxRounds
precedent.

Fixes #842

* fix(llmloop): share the main-loop stop reason with the scan path

PR #855 named the empty-round and compression stops in the diff-review
manifest reason, but two gaps remained.

A MainLoopStop constant added later would fall through
classifyMainLoopStop's default and inherit the collapsed "main task
stopped before completing" text without failing a test — the exact shape
of #842, reintroduced by the next enum addition. classifyMainLoopStop now
keys only on StopMaxRounds for the budget class and delegates every reason
to MainLoopStop.Reason(), whose own default names the unrecognized value.

internal/scan discarded the MainLoopStop entirely and hardcoded a second
opaque sentence. Scan sessions opt out of the run manifest, so that string
is their whole diagnostic: warningsForOutput only drops scan_subtask_error
warnings when a manifest exists, and under --format json the [ocr] progress
lines that would say which exit fired are discarded. It now appends the
shared Reason(), keeping the prefix that resume records and existing
warnings match on.

MainLoopStop also gains String(), so a stop no longer formats as a bare
integer in telemetry, logs and test failure messages.

Tests pin String() and Reason() for every stop, assert neither collides
across stops, and fail when a constant is added past StopCompression —
the prompt to give it its own case. The scan warning test now requires the
trigger to be named rather than only that the task did not complete.

---------

Co-authored-by: Fanzzzd <fanzzzd@users.noreply.github.com>
Co-authored-by: kite <lizhengfeng.lzf@alibaba-inc.com>
2026-08-20 18:46:56 +08:00
..
agent.go fix(agent): name the main-loop stop trigger in item failure reasons (#855) 2026-08-20 18:46:56 +08:00
agent_test.go fix(review-filter): add submit_filter_result func for review filter stage (#295) 2026-08-15 17:18:51 +08:00
budget_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
coverage_test.go fix(agent): name the main-loop stop trigger in item failure reasons (#855) 2026-08-20 18:46:56 +08:00
estimate.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
estimate_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
getters_test.go test: raise statement coverage to 90% and enforce it in CI (#747) 2026-08-06 12:55:44 +08:00
identity.go feat(resume): add trusted resume validation and transition lineage (#786) (#845) 2026-08-14 11:31:40 +08:00
identity_test.go feat(resume): add trusted resume validation and transition lineage (#786) (#845) 2026-08-14 11:31:40 +08:00
init_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
manifest_hash_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
manifest_integration_test.go fix(resume): preserve checkpoints after Ctrl-C (#902) 2026-08-14 17:42:24 +08:00
preview.go fix(cli): stop preview from creating a review session (#784) 2026-08-08 20:55:54 +08:00
preview_run_test.go fix(cli): stop preview from creating a review session (#784) 2026-08-08 20:55:54 +08:00
preview_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
retry_identity_test.go Feat/llm retry report:SDK retry-attempt observability for review (#785) (#790) 2026-08-13 14:31:18 +08:00
sealed_input_test.go feat(resume): add trusted resume validation and transition lineage (#786) (#845) 2026-08-14 11:31:40 +08:00
util.go chore: remove leftover Chinese from the Go core, CI examples and pages comments (#861) 2026-08-12 15:58:23 +08:00
util_test.go chore: remove leftover Chinese from the Go core, CI examples and pages comments (#861) 2026-08-12 15:58:23 +08:00