Skip to content

Commit f5c6f98

Browse files
committed
Refine human findings summary
1 parent 5cbc407 commit f5c6f98

8 files changed

Lines changed: 74 additions & 23 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This project follows Semantic Versioning.
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Made human review summaries always show `P0`, `P1`, and `P2` counts, with `P3` and `Unknown` shown when non-zero.
12+
913
## [0.6.0] - 2026-07-24
1014

1115
### Added

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ This makes the trend across cycles directly measurable without requiring it to b
277277

278278
### Human format
279279

280-
Human is the built-in format for concise operator output. Every permanent line starts with local `HH:MM:SS`; retryable stage lines then include `[attempt/max] [model/reasoning-effort]` with no separator before the message. The overall terminal line has no attempt or model because it does not belong to a single stage. Human lines omit raw event keys, zero-valued severity buckets, and the redundant `run_started` record. Durations below one minute use seconds rounded to a tenth with a trailing `.0` removed; longer durations use rounded whole seconds in compact `h m s` form. Select `--log-format=kv` when an integration requires the machine-readable event stream.
280+
Human is the built-in format for concise operator output. Every permanent line starts with local `HH:MM:SS`; retryable stage lines then include `[attempt/max] [model/reasoning-effort]` with no separator before the message. The overall terminal line has no attempt or model because it does not belong to a single stage. Human lines omit raw event keys and the redundant `run_started` record. A findings summary always shows `P0`, `P1` and `P2`, while `P3` and `Unknown` appear only when non-zero. Durations below one minute use seconds rounded to a tenth with a trailing `.0` removed; longer durations use rounded whole seconds in compact `h m s` form. Select `--log-format=kv` when an integration requires the machine-readable event stream.
281281

282282
When diagnostic session logging is enabled and its record directory has been created, human output first writes exactly one permanent path handoff such as `22:14:05 Session log: /Users/me/.code-converge/session-logs/session-...`. It contains no session content. `kv` output and `--no-session-log` omit this line.
283283

@@ -286,7 +286,7 @@ When diagnostic session logging is enabled and its record directory has been cre
286286
| Review starts in the initial phase (non-TTY) | `22:14:05 [1/10] [gpt-5.6-sol/high] Review started` |
287287
| Review starts after the first CI recovery (non-TTY) | `22:14:05 [1/10] [gpt-5.6-sol/high] Review started (phase 2 after CI recovery 1)` |
288288
| Review is clean | `22:14:05 [2/10] [gpt-5.6-sol/high] Review: clean (1m 27s)` |
289-
| Review has findings | `22:14:05 [2/10] [gpt-5.6-sol/high] Review: 3 findings — 1 high, 2 medium (2m 13s)` |
289+
| Review has findings | `22:14:05 [2/10] [gpt-5.6-sol/high] Review: 3 findings [P0:0; P1:1; P2:2] (2m 13s)` |
290290
| Review fails | `22:14:05 [2/10] [gpt-5.6-sol/high] Review failed (2m 13s)` |
291291
| Fix findings starts / succeeds / fails | `22:14:05 [2/10] [gpt-5.6-luna/medium] Fixing findings` / `22:14:05 [2/10] [gpt-5.6-luna/medium] Findings fixed (4m 23s)` / `22:14:05 [2/10] [gpt-5.6-luna/medium] Fixing findings failed (4m 23s)` |
292292
| Finalization starts | `22:14:05 [gpt-5.3-codex-spark/agent-default] Finalizing` |
@@ -300,7 +300,7 @@ When diagnostic session logging is enabled and its record directory has been cre
300300
| Operational failure | `22:14:05 Failed due to an operational error (8m 45s, exit 2)` |
301301
| CI remains red | `22:14:05 Stopped: CI is still failing (8m 45s, exit 3)` |
302302

303-
A findings summary always includes the total and only its non-zero severity counts, ordered critical, high, medium, low, unknown. Successful terminal lines omit exit `0`; failure terminal lines retain exit codes `1`, `2`, and `3`.
303+
A findings summary always includes the total. It always renders `P0`, `P1` and `P2`, then appends non-zero `P3` and `Unknown` counts. Successful terminal lines omit exit `0`; failure terminal lines retain exit codes `1`, `2`, and `3`.
304304

305305
### Liveness
306306

‎internal/event/event.go‎

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package event
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"io"
78
"math"
@@ -485,21 +486,39 @@ func renderHuman(eventName string, fields []Field, maxCycles, maxCIRecoveries in
485486
case "failed":
486487
return fmt.Sprintf("%s failed (%s)", prefix, d), nil
487488
case "findings":
488-
parts := make([]string, 0, 5)
489-
for _, severity := range []string{"critical", "high", "medium", "low", "unknown"} {
490-
if count := values["findings_"+severity]; count != "" && count != "0" {
491-
parts = append(parts, count+" "+severity)
492-
}
489+
total, err := humanFindingCount(values, "findings_total", true)
490+
if err != nil {
491+
return "", err
492+
}
493+
if total == 0 {
494+
return "", errors.New("findings status has no findings")
493495
}
494-
if len(parts) == 0 {
495-
return "", fmt.Errorf("findings status has no non-zero severity counts")
496+
priorities := []struct {
497+
label string
498+
field string
499+
required bool
500+
}{
501+
{label: "P0", field: "findings_critical", required: true},
502+
{label: "P1", field: "findings_high", required: true},
503+
{label: "P2", field: "findings_medium", required: true},
504+
{label: "P3", field: "findings_low"},
505+
{label: "Unknown", field: "findings_unknown"},
506+
}
507+
parts := make([]string, 0, len(priorities))
508+
for _, priority := range priorities {
509+
count, err := humanFindingCount(values, priority.field, priority.required)
510+
if err != nil {
511+
return "", err
512+
}
513+
if priority.required || count > 0 {
514+
parts = append(parts, fmt.Sprintf("%s:%d", priority.label, count))
515+
}
496516
}
497-
total := values["findings_total"]
498517
noun := "findings"
499-
if total == "1" {
518+
if total == 1 {
500519
noun = "finding"
501520
}
502-
return fmt.Sprintf("%s: %s %s — %s (%s)", prefix, total, noun, strings.Join(parts, ", "), d), nil
521+
return fmt.Sprintf("%s: %d %s [%s] (%s)", prefix, total, noun, strings.Join(parts, "; "), d), nil
503522
}
504523
case "stage_completed":
505524
d, err := duration("duration_ms")
@@ -583,6 +602,21 @@ func renderHuman(eventName string, fields []Field, maxCycles, maxCIRecoveries in
583602
return "", fmt.Errorf("unsupported human event %s with fields %#v", eventName, fields)
584603
}
585604

605+
func humanFindingCount(values map[string]string, field string, required bool) (int, error) {
606+
value, found := values[field]
607+
if !found || value == "" {
608+
if required {
609+
return 0, fmt.Errorf("findings status is missing %s", field)
610+
}
611+
return 0, nil
612+
}
613+
count, err := strconv.Atoi(value)
614+
if err != nil || count < 0 {
615+
return 0, fmt.Errorf("invalid %s %q", field, value)
616+
}
617+
return count, nil
618+
}
619+
586620
func (l *Logger) humanPrefix(attempt, model, effort string) string {
587621
prefix := l.now().Format("15:04:05") + " "
588622
if attempt != "" {

‎internal/event/event_test.go‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func TestHumanEventCatalog(t *testing.T) {
5757
{"run started omitted", "run_started", nil, ""},
5858
{"review start", "stage_started", []Field{F("stage", "review"), F("review_phase", "1"), F("cycle", "1")}, "10:04:05 [1/10] [gpt-test/high] Review started\n"},
5959
{"review after ci", "stage_started", []Field{F("stage", "review"), F("review_phase", "2"), F("cycle", "1")}, "10:04:05 [1/10] [gpt-test/high] Review started (phase 2 after CI recovery 1)\n"},
60-
{"review findings", "review_completed", []Field{F("stage", "review"), F("review_phase", "1"), F("cycle", "2"), F("status", "findings"), F("findings_total", "3"), F("findings_critical", "0"), F("findings_high", "1"), F("findings_medium", "2"), F("findings_low", "0"), F("findings_unknown", "0"), F("duration_ms", "133000")}, "10:04:05 [2/10] [gpt-test/high] Review: 3 findings — 1 high, 2 medium (2m 13s)\n"},
60+
{"review findings", "review_completed", []Field{F("stage", "review"), F("review_phase", "1"), F("cycle", "2"), F("status", "findings"), F("findings_total", "3"), F("findings_critical", "0"), F("findings_high", "1"), F("findings_medium", "2"), F("findings_low", "0"), F("findings_unknown", "0"), F("duration_ms", "133000")}, "10:04:05 [2/10] [gpt-test/high] Review: 3 findings [P0:0; P1:1; P2:2] (2m 13s)\n"},
61+
{"review findings with optional priorities", "review_completed", []Field{F("stage", "review"), F("cycle", "2"), F("status", "findings"), F("findings_total", "5"), F("findings_critical", "1"), F("findings_high", "0"), F("findings_medium", "2"), F("findings_low", "1"), F("findings_unknown", "1"), F("duration_ms", "1")}, "10:04:05 [2/10] [gpt-test/high] Review: 5 findings [P0:1; P1:0; P2:2; P3:1; Unknown:1] (0s)\n"},
6162
{"review clean", "review_completed", []Field{F("stage", "review"), F("cycle", "3"), F("status", "clean"), F("duration_ms", "87000")}, "10:04:05 [3/10] [gpt-test/high] Review: clean (1m 27s)\n"},
6263
{"review failed", "review_completed", []Field{F("stage", "review"), F("cycle", "1"), F("status", "failed"), F("duration_ms", "12500")}, "10:04:05 [1/10] [gpt-test/high] Review failed (12.5s)\n"},
6364
{"fix start", "stage_started", []Field{F("stage", "fix-findings"), F("cycle", "2")}, "10:04:05 [2/10] [gpt-test/high] Fixing findings\n"},
@@ -134,10 +135,14 @@ func TestAgentOutputWithoutViewNeverWritesWorkflowStdout(t *testing.T) {
134135
}
135136
}
136137

137-
func TestHumanFindingsRequiresNonZeroSeverity(t *testing.T) {
138+
func TestHumanFindingsRequiresPriorityCountersAndPositiveTotal(t *testing.T) {
138139
logger := Logger{Out: ioDiscard{}, Format: "human"}
139-
err := logger.Emit("review_completed", F("stage", "review"), F("cycle", "1"), F("status", "findings"), F("findings_total", "0"), F("findings_high", "0"), F("duration_ms", "1"))
140-
if err == nil || !strings.Contains(err.Error(), "no non-zero") {
140+
err := logger.Emit("review_completed", F("stage", "review"), F("cycle", "1"), F("status", "findings"), F("findings_total", "1"), F("findings_high", "0"), F("duration_ms", "1"))
141+
if err == nil || !strings.Contains(err.Error(), "findings_critical") {
142+
t.Fatalf("error = %v", err)
143+
}
144+
err = logger.Emit("review_completed", F("stage", "review"), F("cycle", "1"), F("status", "findings"), F("findings_total", "0"), F("findings_critical", "0"), F("findings_high", "0"), F("findings_medium", "0"), F("duration_ms", "1"))
145+
if err == nil || !strings.Contains(err.Error(), "no findings") {
141146
t.Fatalf("error = %v", err)
142147
}
143148
}

‎internal/workflow/workflow_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func TestHumanHappyPath(t *testing.T) {
171171
t.Fatalf("code=%d stderr=%q", code, stderr)
172172
}
173173
for _, want := range []string{
174-
"10:00:00 [1/1] [gpt-5.6-sol/medium] Review started\n", "10:00:00 [1/1] [gpt-5.6-sol/medium] Review: 3 findings — 1 high, 2 medium (0s)\n",
174+
"10:00:00 [1/1] [gpt-5.6-sol/medium] Review started\n", "10:00:00 [1/1] [gpt-5.6-sol/medium] Review: 3 findings [P0:0; P1:1; P2:2] (0s)\n",
175175
"10:00:00 [1/1] [gpt-5.6-luna/medium] Fixing findings\n", "10:00:00 [1/1] [gpt-5.6-luna/medium] Findings fixed (0s)\n", "10:00:00 [2/1] [gpt-5.6-sol/medium] Review: clean (0s)\n",
176176
"10:00:00 [gpt-5.3-codex-spark/agent-default] Finalizing\n", "10:00:00 [gpt-5.3-codex-spark/agent-default] Commit: done\n", "10:00:00 [gpt-5.3-codex-spark/agent-default] Change request: not needed\n", "10:00:00 [gpt-5.3-codex-spark/agent-default] Finalized successfully (0s)\n", "10:00:00 Done (0s)\n",
177177
} {

‎memory-bank/features/FT-009/brief.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The current workflow stdout contract is stable and machine-readable, but operato
3939
### Scope
4040

4141
- `REQ-01` Provide `human` and structured `kv` workflow log formats, with `human` as the built-in default and no TTY-selected semantic format.
42-
- `REQ-02` Specify and implement human rendering for every current workflow event/result, including local timestamps, `[attempt/max]` retry context before stage model/reasoning context, non-zero severity summaries, readable durations, finalization steps and every terminal exit path.
42+
- `REQ-02` Specify and implement human rendering for every current workflow event/result, including local timestamps, `[attempt/max]` retry context before stage model/reasoning context, fixed `P0`–`P2` findings counters with conditional `P3`/`Unknown`, readable durations, finalization steps and every terminal exit path.
4343
- `REQ-03` Preserve the current stable `key=value` event stream for automation and compatibility when structured mode is selected and heartbeat is disabled.
4444
- `REQ-04` Provide an in-place elapsed-time liveness line with full-line color shimmer for long-running stages when human mode writes to an interactive terminal.
4545
- `REQ-05` Keep non-TTY output newline-safe and ANSI-free by default, and allow an explicit bounded heartbeat for callers that need liveness in redirected output or CI.
@@ -90,7 +90,7 @@ The current workflow stdout contract is stable and machine-readable, but operato
9090
### Exit Criteria
9191

9292
- `EC-01` `human` and `kv` are explicitly selectable through the documented CLI/config/environment contract, with the documented default and precedence.
93-
- `EC-02` Every current event/result and terminal path matches its canonical human rendering: each line has a local timestamp, retryable stage lines put `[attempt/max] [model/reasoning-effort]` before the message, review/fix/CI recovery show their real configured budgets, durations contain no milliseconds, and zero severity counters are omitted.
93+
- `EC-02` Every current event/result and terminal path matches its canonical human rendering: each line has a local timestamp, retryable stage lines put `[attempt/max] [model/reasoning-effort]` before the message, review/fix/CI recovery show their real configured budgets, durations contain no milliseconds, and review findings always show `P0`–`P2` while `P3` and `Unknown` appear only when non-zero.
9494
- `EC-03` Existing `kv` records remain machine-safe and compatible when heartbeat is disabled.
9595
- `EC-04` Human TTY liveness updates in place with elapsed time and full-line shimmer, while no-color behavior retains the timer without color.
9696
- `EC-05` Human non-TTY output is ANSI-free and silent between permanent records unless heartbeat is explicitly enabled; enabled heartbeats are bounded and newline-safe.

‎memory-bank/features/FT-009/decision-log.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ Each material question uses the canonical reasoning cycle: frame the bounded cla
141141
- **Result:** Every human permanent and liveness line begins with local `HH:MM:SS`; retryable stage lines continue with `[attempt/max] [model/reasoning-effort]` and a single space before the message. Review/fix use cycle/max-cycles; CI recovery uses phase/max-ci-recoveries. Interactive human output omits permanent stage-start lines in favour of liveness; non-TTY retains them. The run terminal line retains the timestamp but no stage context.
142142
- **Confidence:** high; direct product decision.
143143

144+
### `DL-13` — Review findings summary counters
145+
146+
- **Status:** resolved by the user; promoted to `brief.md`, `design.md` and the root README.
147+
- **Question:** Which review-priority counters remain visible when their values are zero?
148+
- **Facts:** The user selected the exact human form `Review: <total> findings [P0:<count>; P1:<count>; P2:<count>]`, with `P3` and `Unknown` appended only when non-zero. The existing `kv` record already carries every counter and remains unchanged.
149+
- **Result:** Human review completion always renders total findings plus `P0`, `P1` and `P2`; it adds non-zero `P3` and `Unknown` in that order. No workflow state, review classification or `kv` schema changes.
150+
- **Confidence:** high; direct product decision.
151+
144152
## Review-Improve Cycles
145153

146154
Cycle records are appended after each complete review. A cycle lists only `critical` and `important` findings for remediation; `minor` findings are recorded but not changed unless they block a higher-severity correction.

0 commit comments

Comments
 (0)