Skip to content

Commit d4908b2

Browse files
authored
chore(investigation): expose safe app-server diagnostics (#181)
1 parent b12b076 commit d4908b2

3 files changed

Lines changed: 95 additions & 3 deletions

File tree

dist/index.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112850,6 +112850,34 @@ function codexCredentialEnvironment() {
112850112850
)
112851112851
);
112852112852
}
112853+
function publicInvestigationProcessDiagnostic(stderr) {
112854+
const diagnosticKinds = [
112855+
[
112856+
/(?:stream|disconnect|connection reset|broken pipe|unexpected eof)/iu,
112857+
"stream"
112858+
],
112859+
[
112860+
/(?:context length|too many tokens|maximum context|max(?:imum)? tokens)/iu,
112861+
"context_limit"
112862+
],
112863+
[/(?:invalid.*schema|json schema|structured output)/iu, "schema"],
112864+
[/(?:\bmcp\b|tool transport|tool call)/iu, "transport"],
112865+
[/(?:rate limit|\b429\b|overloaded|capacity)/iu, "capacity"],
112866+
[
112867+
/(?:\b401\b|\b403\b|oauth|authentication|refresh token|not logged in)/iu,
112868+
"authentication"
112869+
],
112870+
[/(?:killed|signal|out of memory|\boom\b)/iu, "resource"],
112871+
[/(?:panic|fatal|internal error)/iu, "internal"]
112872+
];
112873+
return Object.freeze({
112874+
stderrByteCount: Buffer.byteLength(stderr, "utf8"),
112875+
stderrDigest: (0, import_crypto41.createHash)("sha256").update(stderr).digest("hex").slice(0, 16),
112876+
diagnosticKinds: Object.freeze(
112877+
diagnosticKinds.filter(([pattern]) => pattern.test(stderr)).map(([, kind]) => kind)
112878+
)
112879+
});
112880+
}
112853112881
function createConfiguredProductionInvestigationAgents(input) {
112854112882
const processRunner = new NodeReviewAgentProcessRunner();
112855112883
return Object.freeze([
@@ -112860,7 +112888,18 @@ function createConfiguredProductionInvestigationAgents(input) {
112860112888
executionSessions: input.executionSessions,
112861112889
providerCredentialEnvironment: codexCredentialEnvironment,
112862112890
...input.codexBinaryPath ? { binary: input.codexBinaryPath } : {},
112863-
reasoningEffort: "xhigh"
112891+
reasoningEffort: "xhigh",
112892+
processResultObserver: (result2) => {
112893+
if (result2.termination === "exited" /* Exited */ && result2.exitCode === 0) {
112894+
return;
112895+
}
112896+
logger.warn("Review investigation app-server process failed", {
112897+
termination: result2.termination,
112898+
exitCode: result2.exitCode,
112899+
durationMs: result2.durationMs,
112900+
...publicInvestigationProcessDiagnostic(result2.stderr)
112901+
});
112902+
}
112864112903
})
112865112904
}
112866112905
]);

0 commit comments

Comments
 (0)