Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions crates/pi-natives/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,16 +294,6 @@ fn bridge_chunks(
// marks dropped output at the N-API callback boundary instead of silently
// losing it, so truncation is always observable to the caller.
while let Some(chunk) = rx.recv().await {
if dropped_chunks > 0 {
match bounded_tx.try_send(shell_loss_marker(dropped_chunks, dropped_bytes)) {
Ok(()) => {
dropped_chunks = 0;
dropped_bytes = 0;
},
Err(mpsc::error::TrySendError::Full(_)) => {},
Err(mpsc::error::TrySendError::Closed(_)) => break,
}
}
let chunk_len = chunk.len();
match bounded_tx.try_send(chunk) {
Comment on lines 297 to 298

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Flush pending loss markers before EOF

When the callback queue overflows and the command is subsequently aborted or times out, dropped_chunks is now reported only after rx closes. The Bash executor stops accepting callbacks as soon as abort/timeout wins (packages/coding-agent/src/exec/bash-executor.ts:382-384), so this final marker is discarded and the returned output silently omits chunks. Flush a pending marker once callback capacity becomes available without consuming the slot needed by the next retained chunk, rather than waiting exclusively for stream termination.

Useful? React with 👍 / 👎.

Ok(()) => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe("test manifest runner", () => {
expect(result.exitCode, output(result)).toBe(0);
expect(output(result)).toContain(`manifest command receipts complete: ${manifest.commands.length}`);
expect(output(result)).toContain(
"manifest row receipts complete: 570 (telegram=95, discord=95, slack=95, mcp=95, acp=95, daemonCli=95)",
"manifest row receipts complete: 576 (telegram=96, discord=96, slack=96, mcp=96, acp=96, daemonCli=96)",
);
const invocations = (await Bun.file(fake.log).text()).trim().split("\n");
expect(invocations).toHaveLength(manifest.commands.length + manifest.rows.length);
Expand Down
Loading