Skip to content

feat(automation): normalize headless runtime output#523

Merged
luokerenx4 merged 5 commits into
devfrom
feat/headless-structured-output
Jul 11, 2026
Merged

feat(automation): normalize headless runtime output#523
luokerenx4 merged 5 commits into
devfrom
feat/headless-structured-output

Conversation

@luokerenx4

@luokerenx4 luokerenx4 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What changed

  • normalize Claude Code, Codex, OpenCode, and Pi JSONL into one reply/message-block/tool/error contract
  • persist a debounced structured snapshot for live Automation polling and keep bounded historical-tail parsing
  • serialize concurrent task-registry writes, expose the global 8-worker capacity, and prune structured logs with old task records
  • compact Pi diagnostics before disk by discarding documented cumulative message_update / tool_execution_update events; keep a 16 MB per-stream cap as the second guard
  • redesign Automation Runs around compact run cards, final Markdown replies, tool activity/status/input/output, and collapsed runtime diagnostics
  • treat runtime-reported failures as failed runs even when a CLI exits zero
  • cover Codex stream/turn/error items plus command, file, MCP, web-search, and collaboration tool blocks
  • extend packaged Workspace acceptance to exercise the real async Automation API and require a decoded Pi reply, completed tool block, CLI side effect, and compacted diagnostics
  • document each runtime's native stream contract and normalization policy

Runtime contract checks

  • Pi 0.80.6: official JSON mode emits all session events. Packaged async smoke confirms transient update events do not reach diagnostics; deterministic diagnostic tail fell from about 15.8 KB to 7.2 KB.
  • OpenCode 1.17.13: official source and real mock runs emit terminal text/tool events plus step boundaries, not token deltas. Text run: 948 bytes / 3 events. Tool run: 2.3 KB / 6 events with one completed tool snapshot. No filter needed.
  • Codex 0.142.5: official JSONL contract has no token-delta stream; item.updated currently carries todo-list updates. Parser now covers top-level and item errors, failed/declined commands, failed file/MCP calls, web search, and collaboration. Local success sampling is blocked by the installed CLI/model compatibility (gpt-5.6-sol requires a newer Codex), while its real failure stream and the version-matched official event schema are covered.

Verification

  • pnpm test — 2512 passed, 6 skipped
  • npx tsc --noEmit
  • cd ui && npx tsc -b
  • pnpm build
  • real browser at /automation/runs: 69 historical runs, bounded 84.5 px prompt headers, structured reply/tool display, renamed runtime diagnostics
  • pnpm electron:smoke:workspace — packaged Electron Chat Workspace, Git/CLI manifests, managed Pi async task, structured tool output, compacted diagnostics, CLI side effect, and cleanup all passed

Operational cleanup

Removed legacy oversized files only from ~/.openalice/workspaces/state/headless-logs: eight 77 MB–3.0 GB files plus six 17–45 MB files. The directory dropped from roughly 5 GB to 115 MB; Workspace contents were untouched.

This PR is intentionally left open for product review; do not auto-merge yet.

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jul 11, 2026 8:44am

Request Review

@luokerenx4 luokerenx4 merged commit 3f18127 into dev Jul 11, 2026
12 checks passed
@luokerenx4 luokerenx4 deleted the feat/headless-structured-output branch July 11, 2026 08:50
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