Skip to content

Preview row drops ctx% segment — RunRecord lacks maxContext (durable fix for the P3 interim cast) #117

Description

@rz1989s

Summary

The P3 Fleet-tab live preview row mirrors the transcript card's state line, but it always drops the ctx% segment that the card shows — because RunRecord (engine/run-registry.ts) has no maxContext field, while the transcript card's RunCardState gets maxContext from the dispatch path.

Observed (real-pi smoke, same run, same moment)

Transcript card: state ⣾ · ●turn · turn 9 · 1m01s · 582K tok · 58%
Fleet preview: ⣽ · ●turn · turn 9 · 1m01s · 582K tok ← no 58%

Root cause

stateLine() renders the % segment only when both contextTokens and maxContext are set. previewLine() (src/panel/present.ts, P3) builds its state from cardSnapshot(run) where run is a RunRecord — which lacks maxContext, so the segment degrades out (by design, gracefully). The dispatch path knows the model's context window, but never records it on the registry row.

Suggested fix

  1. Add maxContext?: number to RunRecord; set it at dispatch (spawnSubagent knows the model's context window)
  2. cardSnapshot already spreads overrides; previewLine's interim cast (rec as { maxContext?: number }).maxContext (added in the P3 preview task) then becomes a plain typed read

Found while

P3 real-pi smoke (Task 6 acceptance @ 6c66299). Flagged as a Minor during the P3 Task 4 review (the interim cast is the honest in-scope typing); this issue tracks the durable fix.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions