feat: collect rotated agent logs in support bundles#26055
Conversation
|
/coder-agents-review |
|
Chat: Review in progress | View chat deep-review v0.7.1 | Round 2 | Last posted: Round 2, 15 findings (1 P2, 8 P3, 6 Nit), APPROVE. Review Finding inventoryFindings
Round logRound 1Panel (16 reviewers). 1 P2, 8 P3, 5 Nit, 1 Note (dropped). Reviewed against d1d4b89..1f6ee66. Round 2Panel (16 reviewers). CRF-1 through CRF-14 all verified fixed. 1 new Nit. 2 Gon findings dropped (doc verbosity contradicts CRF-7/CRF-8 direction). Reviewed against d1d4b89..f51d46b. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
Documentation CheckUpdates Needed
Automated review via Coder Agents |
There was a problem hiding this comment.
Clean, well-scoped feature. The backward-compatible opt-in via after, the strict lumberjack filename regex, and the boundary-marker format are all sound design choices. Test density is good (42.9%) and the four new agent subtests plus the integration test cover the important paths.
Severity count: 1 P2, 8 P3, 5 Nit.
The P2 is the missing aggregate size limit on the after path. Seven reviewers independently flagged that the endpoint streams all matching files without a cap while the client buffers the full response into memory via io.ReadAll. The old endpoint had a 10MB LimitReader; the new path relies entirely on lumberjack's config (~55MB theoretical max) in a different package with no reference or comment connecting them. Chopper noted a sharper failure mode: if lumberjack fails to rotate (disk full, permissions), the active log grows without bound and the after path serves it all.
Process observation: Commit 1 (8fece08d) built a 100MB cap, truncation header, client-side field, and bundle file. Commit 2 (1f6ee660) removed all of it. The net churn is ~562 lines for a ~288 net-line feature. As Mafu-san put it: the feature never needed this machinery since the lumberjack config already bounds total size. The fix: prefix on commit 2 is also inaccurate; nothing was broken, the approach changed. Consider squashing these commits.
Quote of the round, from Hisoka: "Two commits, two philosophies. Commit 1 built size caps and truncation signaling. Commit 2 tore them out, trusting lumberjack's config in a different package. The code that remains is clean and functional. The hidden coupling between cli/agent.go's rotation config and agent/debuglogs.go's unbounded streaming is the real opponent here."
This is a first-round panel review.
Generated by Coder Agents on behalf of @mafredri
🤖 This review was automatically generated with Coder Agents.
Docs preview📖 View docs preview for |
|
/coder-agents-review |
|
Generated by Coder Agents. Addressed the review feedback in f51d46b:
|
|
/coder-agents-review |
There was a problem hiding this comment.
All 14 R1 findings verified fixed. The fixes are clean and target root causes: CRF-1 (size cap) solved with a remaining counter and io.LimitReader in the loop, tested with a dedicated internal test that verifies exact byte counts. CRF-2 (TOCTOU) solved by moving the boundary write inside the closure after a successful os.Open. CRF-3 (silent stat error) split into its own check with a Warn log. Each fix is proportional and introduces no regressions.
Severity count: 1 new Nit.
Process observation: the PR description still says "without introducing a separate size cap or truncation marker," but the code now has debugLogsWithRotatedLimitBytes = 100 MiB and a truncation warning. The docs and code comments are accurate; only the description is stale. Worth updating before merge.
Quote of the round, from Hisoka: "I pulled every thread this diff offers and nothing snapped."
🤖 This review was automatically generated with Coder Agents.
| debugLogsWithRotatedLimitBytes = 100 * 1024 * 1024 | ||
| ) | ||
|
|
||
| var coderAgentRotatedLogName = regexp.MustCompile(`^coder-agent-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}\.log$`) |
There was a problem hiding this comment.
Nit [CRF-16] coderAgentRotatedLogName is a *regexp.Regexp but reads as a string name. The codebase uses type-indicating suffixes for regex variables: timestampRegex, labelKeyRegex, consecutiveHyphenRegex, WindowsDriveRegex, syntheticPasteFileNamePattern. Consider coderAgentRotatedLogPattern to match the convention. (Gon)
🤖
coder support bundle <workspace>only captured the activecoder-agent.log, so a recent agent restart could leave useful history behind in rotated lumberjack files.Add optional
aftersupport to the agent/debug/logsendpoint. Withoutafter,/debug/logspreserves the existing active-log-only behavior. Support bundles now requestafter=now-24hand include matching rotatedcoder-agent-*.logfiles after the active log, without introducing a separate size cap or truncation marker.Closes #25395
Generated by Coder Agents.