Skip to content

fix: preserve child stderr and attach diagnostic codes - #9

Merged
EauDoon merged 1 commit into
mainfrom
devloop/cycle-04-child-stderr-diagnostics
Aug 29, 2026
Merged

fix: preserve child stderr and attach diagnostic codes#9
EauDoon merged 1 commit into
mainfrom
devloop/cycle-04-child-stderr-diagnostics

Conversation

@EauDoon

@EauDoon EauDoon commented Aug 29, 2026

Copy link
Copy Markdown
Owner

What

Child process failures from decide/act/prove now keep a clipped copy of stderr and a diagnostic code (AAS_CHILD_SPAWN, AAS_CHILD_EXIT, AAS_CHILD_JSON).

  • Error messages name the failing stage and include a one-line stderr snippet.
  • Run reports and manifests record code and stderr on failed/error stages.
  • Human output prints *_code, *_reason, and *_stderr only on failed/error paths (pass-path README sample is unchanged).
  • JSON CLI errors include code, stage, and stderr when present.

Why

runCapture already collected stderr, then threw it away. Operators only saw prove child process exited with status 2 with no child diagnostic. This cycle’s theme is logging, diagnostics, and failure messages.

How tested

  • npm test (35 passing)
  • node --check on bin/aas.mjs, bin/aas-gui.mjs, and scripts/bootstrap.mjs

Devin Review

Child process failures named the stage but dropped stderr, so operators
could not see why decide/act/prove actually failed. Clip and record
stderr on stage errors, tag spawn/exit/JSON problems with AAS_CHILD_*
codes, and print those diagnostics on the human and JSON error paths.
@EauDoon
EauDoon merged commit 32d657c into main Aug 29, 2026
2 of 5 checks passed
@EauDoon
EauDoon deleted the devloop/cycle-04-child-stderr-diagnostics branch August 29, 2026 22:56

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread bin/aas.mjs
Comment on lines +400 to +404
const missing = new Error(`Python not found for decide stage${lastError ? ` (${lastError.code ?? "spawn-error"})` : ""}`);
throw attachChildDiagnostics(missing, {
stage: "decide",
code: DIAGNOSTIC.CHILD_SPAWN,
stderr: lastError?.message,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Decide spawn failures lose stderr

When every Python attempt returns a spawn error with captured output, runDecide keeps only the Error object. The recorded diagnostic substitutes Node’s message for the child’s stderr.

Prompt for agents
In bin/aas.mjs, runDecide discards each ChildResult when result.error is present and retains only result.error. spawnSync can return both an error and captured stderr, such as when maxBuffer is exceeded. Track the last failed ChildResult, then attach its stderr to the final AAS_CHILD_SPAWN error while continuing to use the underlying error code in the reason. Add a test where every Python candidate returns both error and stderr and verify the stage report and manifest preserve the child stderr.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread bin/aas.mjs
Comment on lines +253 to +255
function failedStderr(result) {
const stderr = clipChildStderr(result?.stderr);
return stderr ? { stderr } : {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟨 Child stderr can expose secrets

When a dependency prints credentials in stderr, failedStderr copies them into reports, manifests, GUI responses, downloads, and terminal output. Clipping and control-character removal provide no secret redaction.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant