Skip to content

logger: improve workflow fidelity for next app launch crash logs - #562

Open
snowp wants to merge 1 commit into
mainfrom
crash-log
Open

logger: improve workflow fidelity for next app launch crash logs#562
snowp wants to merge 1 commit into
mainfrom
crash-log

Conversation

@snowp

@snowp snowp commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Evolves the current PreConfigBuffer into a more general InitBuffer that is used to buffer logs for an additional configured time after config load has occurred in order to give the system time to respond to a crash log that needs to be associated with the previous process session.

Upon config load (cached or via API), the InitBuffer buffers for an additional runtime configured period before replaying previous session logs before any of the regular logs. This provides a small buffer for which previous session logs can be replayed in the correct order to avoid thrashing the workflow engine.

Additionally a function is exposed to the platform layer that allows the layer to indicate that a crash report is inbound - this further extends the delay by another configurable amount. Both iOS and Android is able to determine that there is a crash before receiving or parsing the entire report, so this allows us to extend the buffering period for the small subset of app starts where we believe there to be an inbound crash report.

While buffering in the InitBuffer if the buffer capacity is reached we'll end up replaying the logs early. This is a failsafe to avoid dropping logs.

Fixes BIT-9304

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Introduces delayed initialization buffering so prior-run crash logs can replay before current-session logs.

Changes:

  • Replaces PreConfigBuffer with prioritized, capacity-aware InitBuffer.
  • Adds runtime-configurable replay delays and crash-pending hints.
  • Adds tests for delay, prioritization, and capacity behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
bd-runtime/src/runtime.rs Defines replay-delay runtime flags.
bd-logger/src/test/setup.rs Supports custom runtime values in tests.
bd-logger/src/pre_config_buffer.rs Removes the old buffer.
bd-logger/src/pre_config_buffer_test.rs Removes obsolete tests.
bd-logger/src/logging_state.rs Integrates InitBuffer into logging state.
bd-logger/src/logger.rs Exposes crash-pending hints.
bd-logger/src/lib.rs Registers the new buffer module.
bd-logger/src/init_buffer.rs Implements delayed, prioritized buffering and metrics.
bd-logger/src/init_buffer_test.rs Tests buffer limits and prioritization.
bd-logger/src/builder.rs Pins the async buffer future.
bd-logger/src/async_log_buffer.rs Schedules and performs delayed replay.
bd-logger/src/async_log_buffer_test.rs Tests replay timing and ordering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1395 to +1400
() = maybe_await_map(self.pending_init_buffer.as_mut(), |pending_init_buffer| async {
maybe_await(pending_init_buffer.replay_sleep()).await;
}) => {
self
.replay_init_buffer(&state_store, ReplayReason::Scheduled, false)
.await;
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