Summary
When launching a freshopencode pane from a directory other than the freshell project root (e.g. ~/code/foo), the agent reports its working directory as ~/code/freshell instead of the intended directory.
Steps to Reproduce
- Launch freshopencode in directory
~/code/foo
- Ask the agent "what directory are we in?"
- It responds with
~/code/freshell instead of ~/code/foo
Expected Behavior
The agent should report the directory it was launched in (i.e. the cwd/initialCwd provided when the pane was created).
Investigative Notes
- The
freshAgent.create WS message sends cwd: content.initialCwd (src/components/fresh-agent/FreshAgentView.tsx:576)
- The server passes
m.cwd to the runtime manager (server/ws-handler.ts:3093)
- The opencode adapter stores
cwd: normalized.cwd on session create (server/fresh-agent/adapters/opencode/adapter.ts:394)
- The PTY/CLI is spawned via
runCli with the stored cwd (server/fresh-agent/adapters/opencode/adapter.ts:341)
- The adapter then uses
runCli([export, sessionId], cwd) for history reads (server/fresh-agent/adapters/opencode/adapter.ts:309)
The issue may be in how the cwd flows from the UI/initial pane setup through to the adapter — or in how the initialCwd is resolved when creating the pane, potentially falling back to the server process cwd (~/code/freshell).
Affected Components
server/fresh-agent/adapters/opencode/adapter.ts
src/components/fresh-agent/FreshAgentView.tsx
- Possibly the pane creation/cwd resolution flow in the Redux store
Summary
When launching a
freshopencodepane from a directory other than the freshell project root (e.g.~/code/foo), the agent reports its working directory as~/code/freshellinstead of the intended directory.Steps to Reproduce
~/code/foo~/code/freshellinstead of~/code/fooExpected Behavior
The agent should report the directory it was launched in (i.e. the
cwd/initialCwdprovided when the pane was created).Investigative Notes
freshAgent.createWS message sendscwd: content.initialCwd(src/components/fresh-agent/FreshAgentView.tsx:576)m.cwdto the runtime manager (server/ws-handler.ts:3093)cwd: normalized.cwdon session create (server/fresh-agent/adapters/opencode/adapter.ts:394)runCliwith the storedcwd(server/fresh-agent/adapters/opencode/adapter.ts:341)runCli([export, sessionId], cwd)for history reads (server/fresh-agent/adapters/opencode/adapter.ts:309)The issue may be in how the
cwdflows from the UI/initial pane setup through to the adapter — or in how theinitialCwdis resolved when creating the pane, potentially falling back to the server process cwd (~/code/freshell).Affected Components
server/fresh-agent/adapters/opencode/adapter.tssrc/components/fresh-agent/FreshAgentView.tsx