Skip to content

fix(agent): scope @-references to workspace root instead of process CWD#3784

Merged
SivanCola merged 2 commits into
esengine:main-v2from
SuMuxi66:fix/at-ref-cross-workspace
Jun 10, 2026
Merged

fix(agent): scope @-references to workspace root instead of process CWD#3784
SivanCola merged 2 commits into
esengine:main-v2from
SuMuxi66:fix/at-ref-cross-workspace

Conversation

@SuMuxi66

Copy link
Copy Markdown
Contributor

Multi-tab desktop sessions were resolving @file references against the process working directory (os.Getwd()), causing cross-workspace contamination when tabs share the same process.

Changes:

  • controller.go: add WorkspaceRoot() accessor for cpRoot

  • refs.go: detectRefs/resolveBareNames/readFileRef use cpRoot as base directory

  • app.go: workspaceRelative renamed to workspaceRelativeIn with explicit root; AttachDropped uses activeWorkspaceRoot()

  • complete.go: fileItems/searchFileRefs use ctrl.WorkspaceRoot()

All paths fall back to os.Getwd() when workspaceRoot is empty, preserving CLI compatibility.

Closes: #3776

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) agent Core agent loop (internal/agent, internal/control) labels Jun 10, 2026
@SuMuxi66 SuMuxi66 closed this Jun 10, 2026
@SuMuxi66 SuMuxi66 reopened this Jun 10, 2026
@SuMuxi66 SuMuxi66 force-pushed the fix/at-ref-cross-workspace branch from 6402ebe to 63164eb Compare June 10, 2026 05:54
Comment thread internal/control/refs.go Fixed
Comment thread internal/control/refs.go Fixed
Comment thread internal/control/refs.go Fixed
@SuMuxi66 SuMuxi66 force-pushed the fix/at-ref-cross-workspace branch from 63164eb to 0b47d43 Compare June 10, 2026 06:12
Comment thread internal/control/refs.go Fixed
Comment thread internal/control/refs.go Fixed
Comment thread internal/control/refs.go Fixed
@SuMuxi66 SuMuxi66 force-pushed the fix/at-ref-cross-workspace branch from 0b47d43 to b6df49a Compare June 10, 2026 06:31
Comment thread internal/control/refs.go Fixed
Comment thread internal/control/refs.go Fixed
@SivanCola SivanCola force-pushed the fix/at-ref-cross-workspace branch 2 times, most recently from 0e4c30c to d2b8303 Compare June 10, 2026 07:16
Comment thread internal/control/refs.go Fixed
@SivanCola SivanCola force-pushed the fix/at-ref-cross-workspace branch from d2b8303 to a451bcf Compare June 10, 2026 07:21
@SivanCola SivanCola enabled auto-merge June 10, 2026 07:29
Multi-tab desktop sessions were resolving @file references against the process working directory (os.Getwd()), causing cross-workspace contamination when tabs share the same process.

Changes:

- controller.go: add WorkspaceRoot() accessor for cpRoot

- refs.go: detectRefs/resolveBareNames/readFileRef use cpRoot as base directory

- app.go: workspaceRelative renamed to workspaceRelativeIn with explicit root; AttachDropped uses activeWorkspaceRoot()

- complete.go: fileItems/searchFileRefs use ctrl.WorkspaceRoot()

All paths fall back to os.Getwd() when workspaceRoot is empty, preserving CLI compatibility.

Closes: esengine#3776
auto-merge was automatically disabled June 10, 2026 09:13

Head branch was pushed to by a user without write access

@SuMuxi66 SuMuxi66 force-pushed the fix/at-ref-cross-workspace branch from a451bcf to 9424cf2 Compare June 10, 2026 09:13
Scope @-reference detection and TUI subdirectory completion to the active workspace root when one is configured. Use absolute paths for scoped PDF extraction so external tools work outside the process CWD.

Co-authored-by: SuMuxi66 <2728602302@qq.com>

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved after tightening the remaining workspace-scope edges: @ref detection no longer falls back to process CWD when a workspace root is set, TUI subdirectory completion resolves under the active workspace, and scoped PDF extraction passes an absolute path to external extractors. Local targeted tests passed.

@SivanCola SivanCola enabled auto-merge June 10, 2026 09:41
Comment thread internal/control/refs.go
}
statPath = absPath
}
if _, err := os.Stat(statPath); err == nil {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 工作区目录同名文件@引用出现交叉

3 participants