Skip to content

[codex] Structure process diagnostics failures#3389

Merged
juliusmarminge merged 2 commits into
mainfrom
codex/structure-process-diagnostics-errors
Jun 20, 2026
Merged

[codex] Structure process diagnostics failures#3389
juliusmarminge merged 2 commits into
mainfrom
codex/structure-process-diagnostics-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary\n- attach bounded command metadata, working directory, timeout, exit status, and output byte/truncation counts to diagnostics failures\n- preserve exact spawn causes without deriving messages from them or retaining raw process streams\n- include both target and server PIDs when rejecting non-descendant processes

Tests

  • vp test apps/server/src/diagnostics/ProcessDiagnostics.test.ts
  • vp check
  • vp run typecheck

Note

Low Risk
Changes are confined to diagnostics error shaping and messages; behavior of successful reads/signals is unchanged, though alert rules matching old error strings may need updates.

Overview
Process diagnostics failures now carry structured fields instead of relying on stderr text for messages.

Query errors (ProcessDiagnosticsQueryTimeoutError, ProcessDiagnosticsQueryFailedError) gain argCount, cwd, and (for timeouts) timeoutMillis; failed queries also record exitCode plus bounded stdout/stderr byte counts and truncation flags. User-facing messages mention cwd, timeout, and exit code—not raw stderr.

runProcess captures cwd and stream collection metadata once and threads it into both POSIX (ps) and Windows (powershell.exe) failure paths. ProcessDiagnosticsNotDescendantError now includes serverPid alongside the target pid.

A new test asserts failed ps exits produce the expected structured error and message format.

Reviewed by Cursor Bugbot for commit 44734fa. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure process diagnostics errors with bounded command metadata

  • ProcessDiagnosticsQueryFailedError is extended with argCount, cwd, exitCode, stdoutBytes, stderrBytes, stdoutTruncated, and stderrTruncated fields; the raw stderr string is removed from the error.
  • ProcessDiagnosticsQueryTimeoutError gains argCount, cwd, and timeoutMillis fields with an updated message format.
  • ProcessDiagnosticsNotDescendantError gains a serverPid field.
  • The ProcessOutput interface and runProcess function in ProcessDiagnostics.ts now capture cwd and output byte counts/truncation flags on every execution.
  • Behavioral Change: error message formats for timeout and failure errors have changed; callers inspecting the stderr field of ProcessDiagnosticsQueryFailedError will need to use stderrBytes instead.

Macroscope summarized 44734fa.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0f7535ec-bcdc-4a87-9086-67d2c1309e29

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/structure-process-diagnostics-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds structured diagnostic fields to error classes for better error reporting. The changes are additive, don't alter control flow, include tests, and are authored by the file's primary maintainer.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 16:09

Dismissing prior approval to re-evaluate 44734fa

@juliusmarminge juliusmarminge merged commit e01b190 into main Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/structure-process-diagnostics-errors branch June 20, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant