Skip to content

Add iBazel protocol forwarding - #99

Open
longlho wants to merge 4 commits into
keith:mainfrom
perplexityai:main
Open

Add iBazel protocol forwarding#99
longlho wants to merge 4 commits into
keith:mainfrom
perplexityai:main

Conversation

@longlho

@longlho longlho commented Jul 18, 2026

Copy link
Copy Markdown

Why

Wrapping protocol-aware dev servers in multirun currently consumes iBazel's stdin protocol at the parent, so children such as js_run_devserver miss rebuild notifications and HMR degrades.

What changed

  • Add multirun(..., ibazel_notify_changes = True), which advertises legacy and v1 iBazel notification capabilities and runs children in parallel.
  • Detect protocol-aware children directly or through command wrappers.
  • Send legacy notifications to legacy and v1 children, but send structured IBAZEL_EVENT messages only to v1 children.
  • Keep ordinary children disconnected from control input and preserve existing multirun behavior unless notification forwarding is enabled.
  • Document that non-capable children are not restarted.

Depends on ibazel@v0.30.0+ for structured IBAZEL_EVENT notifications. Legacy notifications continue to work with existing iBazel releases.

Related: bazelbuild/bazel-watcher#833

Verification

Ran patched iBazel against the fixture and confirmed notifications arrive before stdin closes. Legacy events reach both legacy and v1 children, structured events reach only v1 children, and the plain child receives neither.

longlho and others added 4 commits July 17, 2026 11:59
## Why

Long-lived `multirun` targets often combine protocol-aware dev servers
with processes that must restart after a successful rebuild.
Filesystem-path routing makes each consumer reconstruct Bazel ownership,
while restarting every process discards useful state.

Structured iBazel events can now report affected direct-target labels.
`multirun` should use that information without coupling restart policy
to a particular workspace.

## What changed

- add opt-in `ibazel_restart_affected_commands` behavior
- record each command's Bazel label in runner instructions
- restart only matching non-notification commands after successful
structured events
- restart all non-notification commands when ownership attribution is
incomplete
- preserve notification forwarding for protocol-aware commands
- manage restart and shutdown process groups across Unix and Windows
- document the generic workflow and add end-to-end restart coverage

The initial build does not restart children. Failed builds never restart
them.
## Why

iBazel notification mode starts the watched target before watch
discovery, then performs a catch-up build. Notification-capable dev
servers can absorb that build, but user-visible commands may open before
the resulting reload and visibly flash or reset.

## What changed

- Add opt-in `ibazel_defer_non_notification_commands`.
- Start notification-capable commands immediately.
- Start remaining commands after the first successful structured build
event.
- Keep deferred commands stopped when the bootstrap build fails.
- Preserve current immediate-start behavior by default.

This is generic orchestration behavior: no knowledge of desktop apps,
browsers, or any consuming repository.
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