-
Notifications
You must be signed in to change notification settings - Fork 251
Fail Claude smoke runs when startup exits before structured log output #16240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,6 +209,12 @@ async function runLogParser(options) { | |
| core.error(`Failed to parse ${parserName} log`); | ||
| } | ||
|
|
||
| // Claude-specific guardrail: if no structured log entries were parsed, treat as execution failure. | ||
| // This catches silent startup failures where Claude exits before producing JSON tool activity. | ||
| if (parserName === "Claude" && (!logEntries || logEntries.length === 0)) { | ||
| core.setFailed("Claude execution failed: no structured log entries were produced. This usually indicates a startup or configuration error before tool execution."); | ||
| } | ||
|
Comment on lines
+214
to
+216
|
||
|
|
||
| // Handle MCP server failures if present | ||
| if (mcpFailures && mcpFailures.length > 0) { | ||
| const failedServers = mcpFailures.join(", "); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,22 @@ describe("log_parser_bootstrap.cjs", () => { | |
| fs.unlinkSync(logFile), | ||
| fs.rmdirSync(tmpDir)); | ||
| }), | ||
| it("should fail Claude runs when no structured log entries are parsed", () => { | ||
| const tmpDir = fs.mkdtempSync(path.join(__dirname, "test-")); | ||
| const logFile = path.join(tmpDir, "test.log"); | ||
| try { | ||
| fs.writeFileSync(logFile, "unstructured log output"); | ||
| process.env.GH_AW_AGENT_OUTPUT = logFile; | ||
| const mockParseLog = vi.fn().mockReturnValue({ markdown: "## Result\n", mcpFailures: [], maxTurnsHit: false, logEntries: [] }); | ||
| runLogParser({ parseLog: mockParseLog, parserName: "Claude" }); | ||
| expect(mockCore.setFailed).toHaveBeenCalledWith( | ||
| "Claude execution failed: no structured log entries were produced. This usually indicates a startup or configuration error before tool execution." | ||
| ); | ||
| } finally { | ||
| fs.unlinkSync(logFile); | ||
| fs.rmdirSync(tmpDir); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test coverage for the zero-entries guardrail ensures silent failures are caught. |
||
| }), | ||
| it("should generate plain text summary when logEntries are available", () => { | ||
| const tmpDir = fs.mkdtempSync(path.join(__dirname, "test-")), | ||
| logFile = path.join(tmpDir, "test.log"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good safeguard! This prevents silent failures where Claude exits before tool execution.