fix(continue): snapshot the active log on reset - #796
Open
OT-WuLong wants to merge 1 commit into
Open
Conversation
Agents write to a random log ID, while reset used the PID-derived fallback. Pass agent.log_path, preserve legacy PID callers, and treat False as logging disabled. Reimplements the focused fix from lsdefine#552 on current main.
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
log_path=Falsewhen logging is disabledCloses #687.
How This Was Found
#687 pointed out that session logs use three different path-generation strategies.
Tracing the current
mainbranch showed thatGenericAgent.log_pathuses a random six-digit ID, while_snapshot_current_log()still looked for a PID-based filename. A temporary-directory reproduction calling the realreset_conversation()consistently produced this result:As a control, resolving the snapshot path to the agent's real log immediately made the log clear and the snapshot appear, confirming that the path mismatch was the root cause.
A later search of historical PRs found #552, which had identified the same issue but was closed after an upstream history rewrite polluted its diff.
Root Cause
GenericAgentwrites each session to a randomly generated six-digit log path, while_snapshot_current_log()derived the current log path from the process PID.As a result,
/newand/continuecould clear the in-memory history without snapshotting or clearing the agent's actual active log.Fix
reset_conversation()now passesagent.log_pathto_snapshot_current_log(). The existing PID lookup remains available when no explicit path is provided.An explicit
Falsevalue continues to mean logging is disabled and will not fall back to or modify a PID-based log.Validation
python -m pytest -q frontends/tests/test_continue_log_snapshot.pypython -m py_compile frontends/continue_cmd.py frontends/tests/test_continue_log_snapshot.pygit diff --checkPrior Work
This is a clean re-roll of the focused fix originally proposed by @AiHyo in #552. That PR was closed after an upstream history rewrite caused it to include hundreds of unrelated changes. This version is rebuilt directly on the current
mainand includes focused regression tests.