Skip to content

fix(trace): preserve tool outcome certainty - #16

Open
yearth wants to merge 1 commit into
cosmtrek:masterfrom
yearth:codex/tool-outcome-certainty
Open

fix(trace): preserve tool outcome certainty#16
yearth wants to merge 1 commit into
cosmtrek:masterfrom
yearth:codex/tool-outcome-certainty

Conversation

@yearth

@yearth yearth commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Why

A normalized event currently exposes only isError. When it is false, consumers cannot tell whether the tool definitely succeeded or the source log never recorded a final outcome.

This extracts the adapter/data-layer part of #14 so mindwalk can preserve that distinction without committing to a Trace Health UI or product contract.

What changed

  • Add optional outcomeKnown evidence to normalized trace events.
  • Preserve Claude Code's explicit is_error: false versus a missing is_error field.
  • Parse Codex command output into known success, known failure, or unknown.
  • Treat structured Codex patch_apply_end.success as a known outcome.
  • Keep the trace schema and TypeScript contract mirror in sync.

The resulting states are:

outcomeKnown isError Meaning
true false known success
true true known failure
absent / false false outcome unknown

outcomeKnown is optional, so traces produced before this change remain valid under the updated schema. Existing isError: true events still identify failures without the new field.

Scope

This PR intentionally does not include session-health derivation, a health API or CLI command, or any UI. It only preserves source evidence in the shared trace model for future consumers such as judge input, comparisons, or metric annotations.

Validation

  • go test -count=1 ./...
  • go vet ./...
  • make test
  • mindwalk trace testdata/claude-session.jsonl smoke check confirmed outcomeKnown: true in exported events

Related to #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant