Skip to content

fix: resolve POSIX path handling and test failures on Windows#3792

Open
Piyush0049 wants to merge 5 commits into
docker:mainfrom
Piyush0049:fix/windows-compatibility-fixes
Open

fix: resolve POSIX path handling and test failures on Windows#3792
Piyush0049 wants to merge 5 commits into
docker:mainfrom
Piyush0049:fix/windows-compatibility-fixes

Conversation

@Piyush0049

Copy link
Copy Markdown
Contributor

Summary

This pull request resolves several path resolution bugs and unit test failures on Windows environments.

Proposed Changes

1. pkg/tools/builtin/filesystem/postedit.go

  • Updated runPostEditCommands to match path-scoped glob patterns (e.g. pkg/*.go) against full relative paths instead of stripping directory names with filepath.Base().

2. pkg/session/session.go

  • Updated AddAttachedFile to recognize POSIX absolute paths starting with / on Windows. This prevents file attachments from being dropped and fixes out-of-bounds slice panics in tests.

3. pkg/tools/workingdir/workingdir.go & workingdir_test.go

  • Updated workingdir.Resolve() to treat leading / as absolute paths across OS boundaries. This prevents paths like /tmp/app from being joined to local host working directories on Windows.
  • Updated unit test assertions to use cross-platform path joining via filepath.Join().

4. pkg/tools/builtin/sessionplan/sessionplan_test.go

  • Updated TestPath assertions to use filepath.Join() for platform path separator compatibility.

5. pkg/tui/internal/editorname/editorname_test.go

  • Updated TestFromEnv to dynamically match platform default editor names (Notepad on Windows, Vi elsewhere).

6. pkg/session/sqlitestore/sqlitestore_test.go

  • Added Windows skip guard for TestNew_DirectoryNotWritable because POSIX permission bits (0o555) do not prevent directory writes on Windows NTFS.

Verification

All affected test suites have been verified and pass cleanly:

  • go test ./pkg/session/...
  • go test ./pkg/session/sqlitestore
  • go test ./pkg/tools/workingdir
  • go test ./pkg/tools/builtin/sessionplan
  • go test ./pkg/tui/internal/editorname

@Piyush0049
Piyush0049 requested a review from a team as a code owner July 22, 2026 18:35
@aheritier aheritier added area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) area/tools For features/issues/fixes related to the usage of built-in and MCP tools area/tui For features/issues/fixes related to the TUI kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Jul 22, 2026
@aheritier
aheritier requested a review from docker-agent July 22, 2026 20:18

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🔴 CRITICAL

This PR introduces two bugs in its path-handling fixes:

  1. postedit.go — Path-scoped glob patterns (containing ) will never match because the code compares a relative pattern against an absolute . Post-edit commands configured with patterns like will silently never execute.

  2. workingdir.go — Removing from the function removes a safety net that guaranteed an absolute path result when is relative.

Comment thread pkg/tools/builtin/filesystem/postedit.go Outdated
Comment thread pkg/tools/workingdir/workingdir.go
@Piyush0049
Piyush0049 force-pushed the fix/windows-compatibility-fixes branch from cc80abb to 9e1b3df Compare July 23, 2026 06:40
@Piyush0049

Copy link
Copy Markdown
Contributor Author

Actually two of my commits were not verified. I fixed them. Please do let me know if any other changes are required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) area/tools For features/issues/fixes related to the usage of built-in and MCP tools area/tui For features/issues/fixes related to the TUI kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants