fix(agent): log lifecycle-end completions at info/warn instead of error#101704
fix(agent): log lifecycle-end completions at info/warn instead of error#101704chenxiaoyu209 wants to merge 3 commits into
Conversation
Co-Authored-By: Claude <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR overlaps the same agent lifecycle log-severity bug as the proof-positive sibling PR, while this branch still lacks after-fix real behavior proof and has an aborted-stop status regression that makes it a weaker landing path. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #101703 as the canonical landing path for #101678, then close overlapping attempts once the chosen fix lands. So I’m closing this here and keeping the remaining discussion on #101703 and #101678. Review detailsBest possible solution: Use #101703 as the canonical landing path for #101678, then close overlapping attempts once the chosen fix lands. Do we have a high-confidence way to reproduce the issue? Yes from source inspection. Current main still routes a successful Is this the best way to solve the issue? No. Reusing the terminal outcome helper is the right direction, but this branch is not the best landing path because it lacks live proof, overlaps the proof-positive sibling PR, and misclassifies abort-path stop metadata when deriving the helper input status. Security review: Security review cleared: The diff only changes in-process agent logging severity and focused tests; it does not touch credentials, dependencies, workflows, package resolution, or other supply-chain surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 453f5968bbca. |
…m logger, add test coverage
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
What Problem This Solves
Successful agent run completions (
stopReason=stop) were logged atconsole.errorlevel, polluting error-level monitoring/alerting with false positives on every normal successful run. This also buries genuine failures in the noise.Fixes #101678
Why This Change Was Made
The
emitLifecycleEndfunction unconditionally usedconsole.errorfor every non-end_turnstop reason, even thoughstopReason=stopis a normal successful completion. The canonical terminal outcome helper (buildAgentRunTerminalOutcome) already classifiesstatus=ok+stopReason=stopasreason=completed— but the logging path was not using this classification.Per the AGENTS.md policy: "Agent run terminal state: normalize/merge via
src/agents/agent-run-terminal-outcome.ts; do not rederive timeout/cancel precedence in projections."User Impact
error-level log line, triggering false alertsinfolevel; unusual non-error stop reasons log atwarnlevelEvidence
agent-run-terminal-outcome.test.tstests (14 passed) confirm the terminal outcome helper correctly classifiesstopReason=stopascompletedagent-command.ingress-diagnostics.test.tstests (13 passed) continue to pass with the changeemitLifecycleEndcall site (agent-command.ts:2462) is only reached when no error is detected — the error path usesemitLifecycleResultError— soconsole.errorwas never the correct level for this path