Skip to content

Fix RunPane empty JSON output under concurrency - #498

Open
parsakhaz wants to merge 1 commit into
mainfrom
pane-cli-fix-cli-empty-output-under-concurrency-493
Open

Fix RunPane empty JSON output under concurrency#498
parsakhaz wants to merge 1 commit into
mainfrom
pane-cli-fix-cli-empty-output-under-concurrency-493

Conversation

@parsakhaz

Copy link
Copy Markdown
Member

Description

Guarantees that every runpane ... --json invocation writes a machine-readable result. Internal, validation, daemon, and empty-success failures now exit nonzero with a structured {"ok":false,"error":{"message":"...","code":"..."}} object on stdout.

Adds --retry N to the shared Node and Python CLI contract. Retries use bounded backoff only for transient failures before the daemon connection succeeds, so delivered mutations are never replayed. CLI contract docs, generated artifacts, and package guidance are updated.

Fixes #493

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have run pnpm typecheck and pnpm lint locally
  • I have tested the Electron app locally with pnpm electron-dev

Critical Areas Modified

  • Session output handling (requires explicit permission)
  • Timestamp handling
  • State management/IPC events
  • Diff viewer CSS

Screenshots (if applicable)

Not applicable. CLI-only change.

Additional Notes

Validated with:

  • pnpm test:runpane-contract
  • pnpm test:runpane-package-smoke
  • pnpm lint
  • pnpm typecheck
  • 40 concurrent failing JSON invocations, with 40 structured failures and 0 empty stdout results

@parsakhaz

Copy link
Copy Markdown
Member Author

Final behavior verification for #493

Before, built directly from origin/main, an unavailable daemon caused a JSON-mode command to emit zero stdout bytes. This deterministic path exited 1; the issue also records the intermittent concurrent variant that exited 0.

$ runpane panes list --json --pane-dir /tmp/unavailable-pane
exit=1 stdout_bytes=0 stderr_bytes=152
Could not connect to Pane daemon at /tmp/pane-daemon-501-40105cc1d97199b0/daemon.sock: connect ENOENT /tmp/pane-daemon-501-40105cc1d97199b0/daemon.sock

After, the same failure is nonzero, stderr is empty, and stdout contains one parseable error object. --retry 2 makes three safe connection attempts before reporting the failure.

$ runpane panes list --json --retry 2 --pane-dir /tmp/unavailable-pane
exit=1 stdout_bytes=226 stderr_bytes=0
{
  "ok": false,
  "error": {
    "message": "Could not connect to Pane daemon at /tmp/pane-daemon-501-fe720455a4a48f77/daemon.sock: connect ENOENT /tmp/pane-daemon-501-fe720455a4a48f77/daemon.sock",
    "code": "ENOENT"
  }
}

A real 40-process concurrent run also completed with no empty results:

{"invocations":40,"nonemptyStructuredFailures":40,"emptyStdout":0}

The Node and Python contract tests additionally force a would-be exit-0 empty JSON result. Both wrappers now convert it to ERR_RUNPANE_EMPTY_JSON_OUTPUT and exit 1. Retries stop once a connection succeeds, so a delivered mutation is never replayed.

@parsakhaz
parsakhaz force-pushed the pane-cli-fix-cli-empty-output-under-concurrency-493 branch from 144eb7a to 6631c5f Compare August 23, 2026 21:37
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.

runpane CLI returns empty output under concurrent calls instead of an error

1 participant