Repository navigation
fix(daemon): rotate non-empty log on start to preserve previous crashes (#991) - #993
Open
yunusarda-sudo wants to merge 1 commit into
Open
yunusarda-sudo wants to merge 1 commit into
yunusarda-sudo wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Author
|
Hi, this is green and ready for review whenever convenient. Thanks! |
…es (browser-use#991) Signed-off-by: Yunus Arda Güney <[email protected]>
yunusarda-sudo
force-pushed
the
fix/daemon-log-rotation-on-start
branch
from
November 25, 2026 23:17
4bf4e0e to
fa2df68
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
src/browser_harness/daemon.py, the daemon entry point calledopen(LOG, "w").close()on every startup, truncating the log file to 0 bytes. Whenensure_daemon()respawned a dead or crashed daemon, the prior daemon's terminal output (WebSocket close code, fatal exceptions, or exit diagnostics) was destroyed before operators or debuggers could inspect it.Changes
_rotate_log(log_path=None)to rotate any existing non-empty log file to{LOG}.1usingos.replace.open(LOG, "w").close()indaemon.py:__main__with_rotate_log(LOG)so previous run diagnostics are retained in{LOG}.1and the active daemon starts fresh.test_rotate_log_preserves_previous_run_outputasserting non-empty log rotation to.1.test_rotate_log_ignores_empty_or_missing_fileasserting empty or missing log files do not produce spurious.1backup files.Closes #991.
Signed-off-by: Yunus Ardaguney [email protected]
Summary by cubic
Fixes the daemon truncating its log on startup so previous crash diagnostics survive respawns.
ensure_daemon()now rotates any non-empty log before opening the child's stderr sink instead of wiping it to 0 bytes, keeping three generations (.1–.3) so all start attempts in the retry loop survive. Remote spawns are now serialized under the same spawn lock as local ones, and rotation is skipped while another daemon is still starting so a concurrent caller cannot move a live child's log.Written for commit fa2df68. Summary will update on new commits.