Repository navigation
fix(s13, s15): tolerate a corrupt line in an agent mailbox - #673
Open
shuhuNB515 wants to merge 1 commit into
Open
shuhuNB515 wants to merge 1 commit into
shuhuNB515 wants to merge 1 commit into
Conversation
read_inbox builds its list with a comprehension over json.loads(line), so a single truncated or malformed line raises JSONDecodeError. The file is only unlinked after the parse, so the bad line stays in place and every later read fails the same way: that agent's inbox is permanently stuck and no message after the corrupt line is ever delivered. Skip lines that do not parse (and non-object payloads) with a warning, then consume the file as usual, matching how the other store loaders treat corrupt entries. Sync the embedded s13/s15 snapshots in versions.json. Disclosed AI assistance: found during an AI-assisted review.
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.
Fixes #672
Problem
MessageBus.read_inbox()ins13_agent_teams/code.pyands15_integrated_harness/code.pyparsed the mailbox with a list comprehension overjson.loads(line). One truncated or malformed line raisedJSONDecodeErrorbeforeinbox.unlink(), so the file was never consumed and every later read failed on the same line. That agent's inbox was permanently stuck and messages after the bad line were never delivered.Change
[bus] skipped ...warning.s13/s15in step: the embedded snapshots inweb/src/data/generated/versions.jsonare regenerated sotests/test_web_scenarios.pystays byte-identical.No README code block shows this implementation (the READMEs only reference
BUS.read_inbox("lead")), sodocs.jsonis unchanged.Verification
Reproduced with a mailbox holding one valid line, one truncated line, and one more valid line:
read_inbox("worker")JSONDecodeError: Unterminated string[](file consumed)Full suite on this branch:
500 passed, 118 subtests passed, 3 failed— 503 tests total. The three failures (test_s_full_background.py×2, onetest_subprocess_output_encoding.pyGBK case) reproduce identically on unmodifiedorigin/mainin this environment (a sandboxmkdirEEXISTand a subprocess decoding case) and are unrelated to this change.Disclosed AI assistance: found during an AI-assisted review; the patch and verification were done with AI assistance.