Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): logs print causes instead of [Object] #16642

Mergedsaphid(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/16642/headmerged by juliusmarminge View on GitHub

Model: built with Claude Opus 5.5 in Claude Code; independent review by GPT-6 Astra.

Problem

When a turn fails to start, the thread banner tells the user to check the server logs, but the log line doesn't say why it failed either:

[10:00:00.000] WARN (#4): pull request watch check failed
{
  threadId: 'thread-1',
  cause: { _id: 'Cause', failures: [ [Object] ] }
}

Logger.consolePretty prints each message object with util.inspect, which stops at depth 2, so a Cause passed as a field (Effect.logWarning("…", { threadId, cause })) collapses to [Object]. Dozens of server log calls pass { cause } this way, including "orchestration V2 provider turn start failed", "orchestration V2 provider event ingestion failed", "pull request watch check failed" and "environment api request failed". A real install's boot-service.log had 637 entries with a collapsed cause when this PR was opened (2026-10-07); the rotated log on the validation host had 9 on 2026-10-14. The full cause only reached the trace file.

Change

serverLogger.ts wraps the console logger. Before it formats a message, any Cause-valued field of a plain-object message is replaced with Cause.pretty(cause). That is the text a Cause gets when it is passed as its own log argument, and what the ~35 call sites that already write cause: Cause.pretty(cause) print:

[10:00:00.000] WARN (#4): pull request watch check failed
{
  threadId: 'thread-1',
  cause: 'Error: gh: HTTP 502 from api.github.com\n' +
    '    at …'
}

The copy is made from property descriptors, so getters are never invoked and symbol-keyed properties survive unchanged. Only string-keyed, direct data properties are converted; a Cause under a symbol key, behind a getter or nested deeper in the message prints as before. Messages with no Cause field, messages with their own Redactable hook (which already decide how they print), class instances and strings pass through untouched. Only the console logger changes; OTLP and span-event export serialize separately and are unchanged. One central change fixes every call site, including future ones, instead of editing each { cause }.

Scope and approval

Small, focused fix for an obvious defect: server logs drop the failure reason they were written to record. No contract, client or log-format changes beyond the collapsed field now printing its text.

Related: #16303 makes the thread banner name the adapter's reason; this fixes the log that banner points to. The two are independent.

Verification

Head da581b0d62 integrates main 44ecfd65b6. The conflict resolution retains upstream startup-pairing token-redaction tests and OTLP host metadata, alongside the cause-formatting tests.

Recovery verification on macOS (2026-10-17): vp test run apps/server/src/serverLogger.test.ts apps/server/src/workspace/WorkspaceFileSystem.test.ts apps/server/src/workspace/WorkspacePaths.test.ts passed all 45 tests. The logger and workspace-file suites passed all 37 tests with the fixes; restoring both production files to fetched main made four tests fail (two logger cause-rendering cases and both short-read cases), with 33 passing. Targeted vp lint, vp fmt --check, git diff --check, and the per-PR vp staged --diff BASE..TREE --no-stash --fail-on-changes hooks passed.

These checks used the existing dependency checkout at 70d60e03a7 with the candidate files and three required upstream files temporarily overlaid, while preserving an unrelated checkout overlay. They did not execute either complete candidate tree. The server typecheck failed with 106 error diagnostic lines; the same lines appeared with both production fixes restored to fetched main, including missing KnownWorkspaces wiring in the older checkout. No passing local full-candidate typecheck or build is claimed. GitHub CI on head da581b0d62 has now passed all eight required checks, including Build and Typecheck and the server test shards. Source files and the real Git index were restored and verified afterward.

The recovery instruction explicitly forbids new delegates or threads, so no new delegated review was launched. The parent reviewed the complete two-file contribution. Automatic CodeRabbit review processed both changed files through da581b0d62 with no actionable findings; Macroscope correctness and approvability checks passed, with approval submitted on that exact head. The historical reviews below cover earlier revisions.

Historical verification: Claude Opus 5.5's original focused run passed nine logger tests and the server typecheck. Two GPT-6 Astra review rounds found descriptor/symbol and redaction-hook receiver issues; the final receiver fix was tested after those rounds, not re-reviewed. A supplied Linux Node A/B through ServerLogger.layer showed collapsed causes on main and readable failure text with this change. A full server run writing to boot-service.log has not been checked.

Original implementation: Claude Opus 5.5 in Claude Code; historical review: GPT-6 Astra. Recovery integration and focused verification: GPT-6.1 Sol through Codex in T3 Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at da581b0

      Macroscope's review found this PR approvable — This is a focused server logging fix that makes existing Cause fields readable in console output while preserving redaction and leaving OTLP/span exports unchanged. Regression tests cover the new formatting path and its safety-sensitive preservation behavior.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 04a6bb51-ec5c-4ad0-b239-a44edcf9855a
      📥 Commits

      Reviewing files that changed from the base of the PR and between 1d183d362e4050d09a7de9858d2c7b5311a29c03 and da581b0d62c88856582f26edfbe8b7c9aabec766.

      📒 Files selected for processing: 2
      • apps/server/src/serverLogger.test.ts
      • apps/server/src/serverLogger.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      📝 Walkthrough

      The server logger formats direct Cause values in plain-object message fields before console output. Both logger configurations use the wrapper. Tests cover cause formatting, getter handling, and redaction behavior.

      Changes: Logger formatting

      Layer / File(s)Summary
      Format and verify Cause fields
      apps/server/src/serverLogger.ts, apps/server/src/serverLogger.test.ts
      The logger formats direct Cause values in plain-object data properties while preserving property descriptors and leaving non-plain or redactable objects unchanged. Both logger configurations use the wrapper. Tests check printed cause details, getter handling, and redaction output.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to da581

      The logger change is mergeable after normal checks; no concrete blocking issue was identified.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 7ce0a

      Existing server-log readers will receive more detailed failures. Custom redaction remains in place, and the change does not add a public endpoint. Sensitive error content and production log-access controls were not fully established, so the assessment remains cautious.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The changed exposure is diagnostic content delivered to readers of console output from this server logging layer. The wrapper applies in both export configurations; it does not itself create a new network destination or grant additional authority.

      Trust Boundaries and Controls

      • observed — Message-level Redactable handling takes precedence over Cause expansion. The added test asserts that the hook receives the original Cause and suppresses its sample secret token. This supports preservation of that control, not a guarantee that every nested failure payload is sanitized.

      Resilience and Maintainability Implications

      • observed — The formatter changes copied property descriptors rather than the original message and reads only data-property values. This avoids invoking message getters during transformation; the added test asserts that a throwing getter remains uncalled.
      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly and concisely describes the main change: server logs now print causes instead of collapsing them to "[Object]".
      Description checkPassedThe description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the defect, implementation, scope, test results, limitations, and review context in su…
      Full details: Description check

      Explanation

      The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the defect, implementation, scope, test results, limitations, and review context in sufficient detail.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. Independent retained-log evidence from the performance audits supports the logging defect described here. Posting one consolidated note because this PR already covers it.

      On the Linux service, the captured log contained four orchestration V2 provider event ingestion failed warnings and fourteen Thread title generation failed warnings whose Cause field collapsed to:

      cause: { _id: 'Cause', failures: [ [Object] ] }

      The relevant upstream call sites still pass raw cause at e536bfd33bc3c351997141d93790df75eeded7b9 (RunExecutionService and ThreadTitleRegenerationService). All four ingestion-warning runs had already reached completed in the retained run data. The collapsed message prevents determining what failed in their post-terminal tails; the data does not establish database is locked or a user-visible run hang as their cause.

      This is confirmation of missing diagnostic content on upstream, not a test of this PR's current logger implementation. No PR code or branch was changed.

    6. juliusmarminge merged thisa4cd921

    7. juliusmarminge closed this

Sign in to join this conversation.