fix(python): un-collapse three source files written through an escape layer - #202
Open
github-actions[bot] wants to merge 1 commit into
Open
fix(python): un-collapse three source files written through an escape layer#202github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
… layer Three .py files have never been parseable. Each one is normal Python up to a point, and then the entire remainder of the file sits on ONE line — 14,245 characters in autonomous_agent.py, 3,852 in test_autonomous_execution.py — with literal two-character `\n`, `\"` and `\\` sequences instead of real newlines and quotes, and a stray `"` at the very end. That is the signature of a file written through a JSON or shell escape layer that was never unescaped: whatever produced it emitted the string's ESCAPED form as the file body. Consequences: `python -c "import autonomous_agent"` fails immediately, so the agent-process container template cannot start the process it exists to start, and scripts/test_autonomous_execution.py cannot run the test it is named for. Neither has ever worked. Repaired by a single left-to-right unescape (`\n`, `\"`, `\\`, `\t`) of the collapsed line, dropping the trailing stray quote. The repair script refuses to write a file that does not `ast.parse`, so an unparseable result could not have been committed even by accident. Recovered 362 real lines in each autonomous_agent.py and 70 in the test. The two autonomous_agent.py copies (agent-process and dev-base/agent-process) were byte-identical before and are byte-identical after — deliberately kept so, since they are the same template vendored twice. Verified beyond parsing: all three pass `compile()`, the recovered code is correctly indented and coherent (the `async with ... as response:` block, the `_setup_workspace` coroutine, the `if __name__ == '__main__':` tail), and `ruff check --select E9,F63,F7,F82` now reports "All checks passed" for the whole repo, down from 19 errors. Found by flipping gate-lint to enforcing in FuzeSDLC#217. Under the old `set +e` … `exit 0` these 19 errors were printed and discarded on every run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GaPa3JgrVNtWrGvqQEAEqv
izzywdev
marked this pull request as ready for review
August 25, 2026 23:44
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
Three
.pyfiles in this repo have never been parseable. Each is normal Python up to a point, and then the entire remainder of the file sits on one line, with literal two-character\n,\"and\\sequences instead of real newlines and quotes, plus a stray"at the very end:containers/templates/agent-process/autonomous_agent.pycontainers/templates/dev-base/agent-process/autonomous_agent.pyscripts/test_autonomous_execution.pyThat is the signature of a file written through a JSON or shell escape layer that was never unescaped — whatever produced it emitted the string's escaped form as the file body.
Consequences:
import autonomous_agentfails immediately, so the agent-process container template cannot start the process it exists to start, andscripts/test_autonomous_execution.pycannot run the test it is named for. Neither has ever worked.The repair
A single left-to-right unescape (
\n,\",\\,\t) of the collapsed line, dropping the trailing stray quote. Deliberately notcodecs.decode(..., 'unicode_escape'), which would mangle the non-ASCII characters present in the test file.The repair script refuses to write a file that does not
ast.parse, so an unparseable result could not have been committed even by accident.agent-process/autonomous_agent.pydev-base/agent-process/autonomous_agent.pyscripts/test_autonomous_execution.pyThe two
autonomous_agent.pycopies were byte-identical before and are byte-identical after — kept so deliberately, since they are the same template vendored twice.Verification
Parsing is a low bar for a change this size, so the result was checked for sanity, not just validity:
compile().async with … as response:block closes properly,_setup_workspaceis a well-formed coroutine, the file ends onif __name__ == '__main__':/asyncio.run(main()).ruff check . --select E9,F63,F7,F82→ All checks passed for the whole repo, down from 19 errors.gate-lintfrom FuzeSDLC#217, run against this tree, exits 0 (it exits 1 onmain).How it survived
gate-lintran ruff on every PR underset +ewith a terminalexit 0, so all 19 errors were printed and discarded every time. Found by flipping that gate to enforcing in FuzeSDLC#217.Note on this PR
Opened automatically as a draft by the stranded-branch detector between my push and my own
create_pull_requestcall; marked ready for review and given its body here. The commit and branch are mine.Related
Companion to FuzeSDLC#217. One of four real defects that flip exposed — the others are FuzeSocial#88, FuzePlan#211, and a missing
import sysin FuzeInfra's tunnel-manager (delegated, not edited from here).