Skip to content

fix(run): budget Windows session paths for generated records - #833

Draft
pj991207 wants to merge 2 commits into
andrewyng:mainfrom
pj991207:fix/run-budget-windows-session-paths
Draft

pj991207 wants to merge 2 commits into
andrewyng:mainfrom
pj991207:fix/run-budget-windows-session-paths

Conversation

@pj991207

@pj991207 pj991207 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Draft status

Draft pending agreement on the Windows session-path strategy. The reproduced failure is real, while root-dependent folder naming, the fixed descendant reserve and policy handling introduce storage-layout maintenance choices that need maintainer direction.

Problem

On Windows, a workspace-derived session name can fit the filesystem's component limit but make the complete default openworker run record path exceed MAX_PATH. The CLI then fails while creating the run or spilling tool output.

Change

Budget the generated workspace component against the absolute state root and run ID, counting UTF-16 code units and reserving room for current generated record/tool-output names. Keep the existing name when it fits and retain a workspace hash when shortening is required. If even a hashed component cannot fit, return a usage error advising a shorter explicit --out path. Explicit output paths keep their current behavior.

Preserve explicit extended-length namespace paths and paths on a standard Python runtime with the Windows LongPathsEnabled policy enabled. If the policy cannot be read, use the legacy budget. This follows Python's documented long-path support. Existing process policy caching and custom executable manifests can affect the platform's behavior.

Reproduction

On native Windows with legacy path limits, select a state root/workspace that makes the generated run path 301 characters and spill path 394 characters on the baseline. Run a scripted headless session that spills output. The baseline exits 1; the patched case exits 0 with paths of 159 and 252 characters. Also exercise an explicit extended-namespace root, which must remain usable.

Focused path regressions:

.venv/Scripts/python.exe -m pytest tests/test_run_cli.py -k windows_session_path -q

Validation

On 5e3d726, a native Windows CLI reproduction exits 1. With the fix it exits 0, reducing its run directory from 301 to 159 characters and its generated spill path from 394 to 252. Coverage includes actual spill writes, distinct workspaces, non-BMP roots, fitting-name preservation and overlong-root errors. The selected CLI run passes 28 tests with three failures reproduced on unmodified main; tool-result tests pass 12/12. The reserve covers current generated records and does not guarantee arbitrary user-created nested paths.

Additional adversarial review reproduced a regression in the initial patch with a valid extended namespace root. The follow-up fixes it and adds native filesystem coverage plus enabled/unreadable-policy cases. All eight targeted checks pass. The full local CLI file reports 31 passed, 7 existing PTY skips and three pre-existing path/JSON fixture failures addressed separately in the Windows fixture portability work.

Tested PR head: 097157535910aa28af601fdb8be63da973986a8e. At this documentation update, pytest, gui-unit and gui-e2e all report success for this head: CI run. Local results above are the previously recorded checks; this body update does not claim a new local test run.

Evidence and limitations

No visible GUI change. Native CLI exit status, generated path lengths and actual spill writes supply the before/after evidence; screenshots are not applicable. The fixed reserve covers current generated descendants only. Enabled long-path policy was tested through the policy interface; the host had legacy policy, while the explicit extended namespace case was also verified with real filesystem writes. Root/policy-dependent storage naming and future reserve maintenance still require design agreement.

Related work

#835 separately repairs the pre-existing path/JSON test fixtures noted in the full CLI run. A shorter explicit --out remains an available workaround while this storage-path design is discussed.

@pj991207
pj991207 marked this pull request as draft November 3, 2026 10:09
@pj991207
pj991207 marked this pull request as ready for review November 3, 2026 10:24
@pj991207
pj991207 marked this pull request as draft November 3, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant