fix(exec): avoid empty update text blocks#73126
Conversation
Greptile SummaryThis PR fixes a bug where an exec update could emit an empty Confidence Score: 5/5Safe to merge — minimal, well-scoped change with correct logic and good test coverage. The change is small, the extracted function is straightforward, and the three added tests cover the targeted fix. Only a missing test for the warnings + non-empty tailText combination was found, which is a low-risk P2 gap. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/bash-tools.exec-runtime.test.ts
Line: 316-337
Comment:
**Missing test for warnings + non-empty output**
The current test matrix covers three of four input combinations for `renderExecUpdateText`. The case where both `tailText` is non-empty and `warnings` is non-empty is untested, leaving the concatenation path (`warningText + tailText`) without a regression guard.
```suggestion
describe("renderExecUpdateText", () => {
it("uses a non-empty placeholder when an exec update has no output", () => {
expect(renderExecUpdateText({ tailText: "", warnings: [] })).toBe("(no output)");
});
it("preserves non-empty exec output", () => {
expect(renderExecUpdateText({ tailText: "hello", warnings: [] })).toBe("hello");
});
it("keeps warnings while still avoiding empty output text", () => {
expect(renderExecUpdateText({ tailText: "", warnings: ["Warning: retrying"] })).toBe(
"Warning: retrying\n\n(no output)",
);
});
it("combines warnings with non-empty output", () => {
expect(renderExecUpdateText({ tailText: "hello", warnings: ["Warning: retrying"] })).toBe(
"Warning: retrying\n\nhello",
);
});
});
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(exec): avoid empty update text block..." | Re-trigger Greptile |
|
Addressed the Greptile suggestion in The new assertion verifies
Validation after the change:
Resolved. |
59070fe to
92af2e1
Compare
92af2e1 to
e526031
Compare
fbfc035 to
c51fbb9
Compare
c51fbb9 to
b97440b
Compare
6023abe to
eff0fbc
Compare
a2049d0 to
f07a8a8
Compare
6762d9e to
c60bb50
Compare
c60bb50 to
1e3b938
Compare
1e3b938 to
d93150d
Compare
Summary
(no output)placeholder when an exec update would otherwise emit an empty text blockFixes #73117
Validation
pnpm exec oxfmt --write --threads=1 src/agents/bash-tools.exec-runtime.ts src/agents/bash-tools.exec-runtime.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.agents.config.ts src/agents/bash-tools.exec-runtime.test.tspnpm exec oxlint src/agents/bash-tools.exec-runtime.ts src/agents/bash-tools.exec-runtime.test.tspnpm check:test-types