Repository navigation
fix(processes): let read_log take a negative offset to mean "the last N lines" - #146938
Open
princejain756 wants to merge 1 commit into
Open
princejain756 wants to merge 1 commit into
princejain756 wants to merge 1 commit into
Conversation
… N lines" lines[offset:offset + limit] with offset=-N becomes lines[-N:0], which is always empty, so a model asking for a log tail via a negative offset got "output": "" back with no hint why. Normalize the start index so a negative offset counts back from the end (clamped at 0), and document it in the offset schema description. Fixes NousResearch#146914
|
Verified at head
Change quote: Gaps stated honestly: ran only the PR's own test file plus the closest neighbor, not the full |
Author
|
Thanks for running this against |
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
Fixes #146914 -
process_manage(action="log")with an explicit negative offset returned empty output:lines[offset:offset + limit]foroffset=-80, limit=80sliceslines[-80:0], which is always empty. Models pass negative offsets to mean "the last N lines" and got""with no error.read_lognow normalizes the slice start:offset < 0counts back from the end (max(total_lines + offset, 0)), sooffset=-80reads "80 lines ending at the tail". Positive/None/0 offsets are unchanged.offsetschema description now documents the negative form so models discover it.Test plan
scripts/run_tests.sh tests/tools/test_process_registry_read_log.py- new file, 2 tests: negative offset returns the tail, and a beyond-start offset clamps to the whole logscripts/run_tests.sh tests/tools/test_process_registry.py- 99 pass, 0 fail (19 platform-gated skips on darwin)python scripts/check- 13 checks ok (the fix is line-neutral inside the already-over-cap file)