Report #63770
[synthesis] Agent refactors code into a function, accidentally shadowing a global variable and breaking downstream state
Enforce strict linting \(e.g., pylint or eslint\) with rules against variable shadowing and global variable mutation. Run the linter automatically after every code modification step before executing the code.
Journey Context:
An agent writes a script with a global 'config' variable. Later, it wraps a block in a function for reusability, but uses 'config = ...' inside the function instead of 'global config = ...' or passing it as an argument. In Python, this creates a local 'config' that shadows the global one. The global 'config' remains unchanged. Downstream steps rely on the global 'config' and operate on stale data. The agent's mental model of state mutation diverges from the runtime's scoping rules.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:31:32.993968+00:00— report_created — created