Skip to content

perf: reduce child, workflow and long-session overhead - #895

Merged
tt-a1i merged 3 commits into
mainfrom
codex/performance-audit
Oct 23, 2026
Merged

tt-a1i merged 3 commits into
mainfrom
codex/performance-audit

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Long sessions and active workflows repeat work on progress updates, retain completed tool payloads beyond the bounded transcript, and rewrite unchanged checkpoint artifacts. Session catalog scans retain abort listeners and repeatedly search growing JSONL records; large Markdown previews create excessive DOM nodes. Related: #841 and the repeated-write portion of #839.

Value

Reduces avoidable CPU, allocation and disk work without changing Pi-owned execution history, authority or terminal evidence. Local diagnostics reduced ten preview-only checkpoints from 15,630,840 to 195,770 written bytes, and a 16 MiB JSONL record from 2.17 billion to 16.78 million newline-search characters. These are mechanism measurements, not application-wide latency guarantees.

Approach

  • Wake direct-child waiters only when a pending child stops being busy; keep live progress notifications.
  • Release completed native tool payloads after transcript eviction, preserving pending tools and queued future events.
  • Filter workflow recovery by session before artifact hydration and avoid graph rebuilds for preview-only updates.
  • Reuse unchanged live checkpoint side files after digest and filesystem-identity checks; repair missing/changed files, always publish complete terminal artifacts, and memoize bounded journal JSON.
  • Clean catalog cancellation listeners, parse chunk-spanning JSONL records linearly, and reuse fitted footer segments.
  • Separate an existing Git process output test from a one-second Windows startup assumption: use a ten-second test budget, retaining the dedicated 20 ms timeout check and unchanged production deadlines.
  • Show complete loaded Markdown source above 100,000 characters with a notice; smaller files retain rich rendering.

Validation

  • bun run check: passed again before submission.
  • bun run test: submission-time rerun passed 2,368 Node tests (8 skips) and 1,512 UI tests in 97 files.
  • node scripts/web-performance.mjs: 11 production-bundle browser cases passed.
  • Child-startup diagnostic: all nine child-count/foreign-run combinations passed with zero foreign artifact reads.
  • Real provider success, missing-file error, cancellation and workflow delivery inspected; native TUI visuals confirmed by the user. Browser large-file pagination retained all text.
  • Final author-side review of 9f7f840392319730e59362a8cdbc6008e82148c9 found no blocking defects. All 18 checks passed on that exact head, including Linux/Windows, browser E2E and required aggregate checks. CI run: https://github.com/openpi-dev/openpi/actions/runs/39885170684. Windows CI exposed the existing output-test startup deadline described above; after repair, its focused local and remote checks passed. Raw private Session evidence remains outside Git.

Impact

  • User-visible: large Markdown uses source rendering; native recent tool cards remain available, while evicted cards may use compact history.
  • Model-visible context/tools: no schema or authority changes; redundant pending notifications removed.
  • Runtime/lifecycle: less repeated work and completed-result retention; cancellation, restart and terminal publication preserved.
  • Persisted config/data: no migration or configuration change; artifact formats unchanged.
  • Compatibility/risk: filesystem identity guards checkpoint reuse; terminal commits bypass it. Full transcript serialization and trust-sensitive resource discovery remain unchanged. Detailed evidence and limitations: docs/research/PERFORMANCE_AUDIT_2026-10-23.md.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area:workflows Workflow engine, capability, skills, or tests area:subagents Subagent delegation, skills, or tests area:ui Terminal UI, rendering, themes, or visual assets labels Oct 23, 2026

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 1061f966d3c0837a3d6904069af7bf411762b4d6 against ea4dfb993793ccdb093229588b6ccd3467afd90a. No blocking code findings.

Checked cancellation/restart waiter semantics; direct-child queued-event ordering and completed-only renderer eviction; workflow snapshot retention; session filtering before artifact hydration; graph lifecycle refreshes; checkpoint digest/file-identity validation and unconditional terminal publication; journal append invalidation; UTF-8/chunk/final-line catalog parsing and listener cleanup; footer fit reuse; and full-text preservation when large Markdown switches to source. Reviewed the associated regressions and generated bundle boundary.

Fresh local gates: bun run check passed; bun run test passed 2,368 Node tests (8 skips), plus 1,512 UI tests in 97 files. Existing exact-implementation production browser and real-provider evidence remains applicable; TUI visuals were confirmed by the user. Full transcript serialization and trust-sensitive resource discovery deliberately remain unchanged.

This is an author-side code review, not an independent approving review. Merge still depends on exact-head CI and the repository's approval requirements.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final review at 9f7f840392319730e59362a8cdbc6008e82148c9: no blocking code findings. The only follow-up since the previous review changes the existing Git process output test budget from 1 to 10 seconds, with an explanatory comment and research receipt. Windows had returned timeout code -1 before the expected exit code 7; the dedicated 20 ms timeout regression and production deadlines are unchanged.

Focused process tests pass all three cases. Fresh bun run check and complete bun run test pass again (2,368 Node tests, 8 skips; 1,512 UI tests / 97 files). Product implementation and the previously validated production bundle are unchanged. Awaiting CI on this exact head and the required independent approval; this author-side review does not replace that approval.

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

Labels

area:subagents Subagent delegation, skills, or tests area:ui Terminal UI, rendering, themes, or visual assets area:workflows Workflow engine, capability, skills, or tests documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant