Preserve daemon diagnostics and include updater logs in reports (#49843)

## Why

Detached launches truncate stderr logs, losing details from previous failures. Updater handoffs can also leave existing writers with stale offsets after truncation.

## What changed

- Record daemon lifecycle and update stages with timings, outcomes, and typed OS errors, omitting error messages and context.
- Preserve the last 256 KiB of nonempty stderr logs before truncation and use append handles to prevent gaps during handoff. Preservation failures do not block launch.
- Attach current and previous updater log tails when log inclusion is enabled for a report, with a 512 KiB total limit and legacy filename fallback. Skip missing, empty, and nonregular files.

## Testing

Add regression coverage for diagnostic error redaction, bounded log preservation, append behavior during handoff, attachment selection, and updater logs in captured report uploads.

GitOrigin-RevId: 918317022ab9dcfd1b13d676872706c77e9ffbb2
This commit is contained in:
Eric Traut
2026-10-01 03:24:18 +00:00
committed by copyberry
parent e53e932dc8
commit 08b07eef12
15 changed files with 587 additions and 32 deletions
@@ -268,10 +268,15 @@ impl FeedbackRequestProcessor {
let session_source = self.thread_manager.session_source();
let runtime_handle = tokio::runtime::Handle::current();
let codex_home = self.config.codex_home.clone();
let upload_result = tokio::task::spawn_blocking(move || {
// Cancelling the RPC waiter must not release a still-running upload's slot.
let _permit = permit;
if include_logs {
extra_attachments
.extend(codex_feedback::daemon_log_attachments(codex_home.as_path()));
}
let tags = (!upload_tags.is_empty()).then_some(&upload_tags);
runtime_handle.block_on(snapshot.upload_feedback(
FeedbackUploadOptions {