Skip to content

Flush managed runs when child processes exit - #19

Merged
Stephen Belanger (Qard) merged 2 commits into
mainfrom
t3code/audit-daemon-flush-timing
Aug 12, 2026
Merged

Flush managed runs when child processes exit#19
Stephen Belanger (Qard) merged 2 commits into
mainfrom
t3code/audit-daemon-flush-timing

Conversation

@Qard

Copy link
Copy Markdown
Collaborator

Summary

  • tag events from each managed child process tree with an invocation-local ID
  • group accepted daemon sessions by invocation and flush them after the child exits
  • propagate the grouping through command hooks and shared JavaScript adapters without flushing unrelated sessions

Why

bt trace run previously depended on terminal agent hooks to trigger delivery. If the child exited nonzero, was terminated by a signal, or was interrupted before a terminal hook, the managed run could return without an awaited backend flush.

Impact

Managed runs now perform a scoped final flush after every child exit path, including success, nonzero exit, signal termination, and parent interruption. Each session gets a 10-second flush timeout. Flush failures remain fail-open and do not replace the child's exit status.

Validation

  • make test
  • cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked
  • cargo clippy --manifest-path bt-daemon/Cargo.toml --all-targets --all-features --locked -- -D warnings
  • cargo fmt --manifest-path bt-daemon/Cargo.toml -- --check
  • pnpm test in src/runtime/js-daemon-client
  • git diff --check

@Qard
Stephen Belanger (Qard) marked this pull request as ready for review August 12, 2026 20:26
@Qard
Stephen Belanger (Qard) merged commit 5fbfb5e into main Aug 12, 2026
20 checks passed
@Qard
Stephen Belanger (Qard) deleted the t3code/audit-daemon-flush-timing branch August 12, 2026 21:03
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.

2 participants