fix: prevent log.writeSummary from overwriting reportProgress content (#87)

* fix: prevent log.writeSummary from overwriting reportProgress content

The run summary was showing logs instead of the final reportProgress content
because log.writeSummary() was called after reportProgress. Now
log.writeSummary() checks if the summary was already overwritten by
reportProgress and skips if so.

Fixes #86

* refactor: replace dynamic import with static import in cli.ts

Replace unnecessary dynamic import of wasSummaryOverwritten with
static import. No circular dependency exists since comment.ts doesn't
import from cli.ts.

* Fix run summary writing

---------

Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
This commit is contained in:
pullfrog[bot]
2026-01-15 00:55:42 +00:00
committed by pullfrog[bot]
parent 6e2a15c195
commit 71feba0a76
11 changed files with 12564 additions and 4609 deletions
+2 -2
View File
@@ -167,7 +167,7 @@ export const opencode = agent({
// 8. log tokens if they weren't logged yet (fallback if result event wasn't emitted)
if (!tokensLogged && (accumulatedTokens.input > 0 || accumulatedTokens.output > 0)) {
const totalTokens = accumulatedTokens.input + accumulatedTokens.output;
await log.summaryTable([
log.table([
[
{ data: "Input Tokens", header: true },
{ data: "Output Tokens", header: true },
@@ -571,7 +571,7 @@ const messageHandlers = {
);
if ((inputTokens > 0 || outputTokens > 0) && !tokensLogged) {
await log.summaryTable([
log.table([
[
{ data: "Input Tokens", header: true },
{ data: "Output Tokens", header: true },