-
Notifications
You must be signed in to change notification settings - Fork 444
[rendering-scripts] fix(copilot-parser): render bash command from data.command in SDK events #43750
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
5309e00
6019463
6b5adc5
014a568
1538d63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,6 +138,23 @@ describe("parse_copilot_log.cjs", () => { | |
| expect(result.markdown).toContain("file1.txt"); | ||
| }); | ||
|
|
||
| it("renders the bash command from data.command in Copilot CLI events.jsonl", () => { | ||
| // Real Copilot SDK events carry the executed command as a top-level data.command | ||
| // field on tool.execution_start, not nested inside data.input/data.parameters. | ||
| const eventsLog = [ | ||
| '{"type":"user.message","timestamp":"2026-06-05T00:44:01.367Z","data":{}}', | ||
| '{"type":"tool.execution_start","timestamp":"2026-06-05T00:44:04.520Z","data":{"toolName":"bash","mcpServerName":"","command":"cat /tmp/gh-aw/agent/candidates.txt"}}', | ||
| '{"type":"tool.execution_complete","timestamp":"2026-06-05T00:44:04.700Z","data":{"toolName":"bash","mcpServerName":"","success":true,"result":{"content":"candidate-list-output"}}}', | ||
| '{"type":"assistant.message","timestamp":"2026-06-05T00:44:59.769Z","data":{"content":"Done"}}', | ||
| ].join("\n"); | ||
|
|
||
| const result = parseCopilotLog(eventsLog); | ||
|
|
||
| expect(result.markdown).toContain("bash"); | ||
| expect(result.markdown).toContain("cat /tmp/gh-aw/agent/candidates.txt"); | ||
|
Contributor
Author
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. [/tdd] The regression test covers the happy path (command present on 💡 Suggested additional testit('merges data.command into existing data.input when base.command is absent', () => {
const eventsLog = [
'{"type":"user.message","data":{}}',
'{"type":"tool.execution_start","data":{"toolName":"bash","mcpServerName":"","input":{"cwd":"/tmp"},"command":"ls"}}',
'{"type":"tool.execution_complete","data":{"toolName":"bash","mcpServerName":"","success":true,"result":{"content":"out"}}}',
'{"type":"assistant.message","data":{"content":"Done"}}',
].join('\n');
const result = parseCopilotLog(eventsLog);
expect(result.markdown).toContain('ls');
expect(result.markdown).toContain('/tmp'); // cwd from input preserved
});@copilot please address this.
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. Addressed in 1538d63. Added regression coverage for the merge path where structured input is preserved and |
||
| expect(result.markdown).toContain("candidate-list-output"); | ||
| }); | ||
|
|
||
| it("renders tool output preview from array-based result.content in Copilot CLI events.jsonl", () => { | ||
| const eventsLog = [ | ||
| '{"type":"user.message","timestamp":"2026-06-05T00:44:01.367Z","data":{}}', | ||
|
|
||
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.
[/tdd] The
buildToolInput(data)call here uses data from atool.execution_completeevent (orphaned completion path). Real SDK completion events do not carry acommandfield, so this will always return{}— the logic is harmless but could mislead future maintainers.💡 Suggestion
Consider making the intent explicit with an inline comment or a plain
{}:A small test for the orphaned-completion path would also document this behaviour as a spec.
@copilot please address this.
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.
Addressed in 1538d63. The orphaned completion fallback now preserves structured input while explicitly skipping command synthesis, since completion payloads cannot reliably recover the original command.