Skip to content

readJobProgressPreview treats bracketed lines inside logged message blocks as progress updates #844

Open

Description

@adityajai119

Summary

readJobProgressPreview in plugins/codex/scripts/lib/job-control.mjs extracts recent progress lines from jobs/<id>.log for /codex:status (job.progressPreview) and inferLegacyJobPhase. Because it matches any line starting with [ (line.startsWith("[")) and strips /^\[[^\]]+\]\s*/, bracket-prefixed lines inside multi-line blocks written by appendLogBlock (Assistant message, Subagent <name> message, Reasoning summary, Review output, Final output) are misread as timestamped progress updates.

Reproduction

  1. Create a job log with createJobLogFile, appendLogLine, and appendLogBlock:
    • appendLogLine(logFile, "Thread ready (thr_1).")
    • appendLogLine(logFile, "Turn started (turn_1).")
    • appendLogBlock(logFile, "Assistant message", "[package]\nname = \"demo\"\n[1]: https://example.com/spec\n[x] Verified baseline")
  2. Call readJobProgressPreview(logFile, 4) (or enrichJob on a running/failed job).

Actual

readJobProgressPreview treats [1]: https://example.com/spec and [x] Verified baseline as log headers, strips the leading [...] token (": https://example.com/spec", "Verified baseline"), and pushes real progress updates out of progressPreview. Similarly, a bracketed line inside a subagent or assistant message block such as [step 2] Applying 3 file change(s)... becomes "Applying 3 file change(s)..." and causes inferLegacyJobPhase to report "editing" instead of "investigating". Quoted ISO-timestamped lines inside the Final output block also leak into progressPreview.

Expected

readJobProgressPreview should only parse genuine ISO-8601 UTC timestamped log entry headers ([YYYY-MM-DDTHH:mm:ss.sssZ] ...), ignore bracket-prefixed lines inside logged message/review/reasoning blocks, and stop at the terminal Final output block header.

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