Make local workspace init opt-in and tighten media, session close, and workdir concurrency paths uncovered by the post-merge review.
Co-authored-by: Cursor <cursoragent@cursor.com>
StartSession in agent/qoder and agent/cursor read a.workDir without
holding a.mu, while SetWorkDir writes a.workDir under the lock. With
/dir live workspace switching the two paths run concurrently, which
the Go race detector flags as a data race.
Move the field read into the existing critical section alongside the
other captured agent state (mode, model, cmd, sessionEnv), then pass
the local copy down to newQoderSession / newCursorSession. Adds a
regression test per agent that fires SetWorkDir and StartSession in
parallel; under -race the buggy code deterministically fails with
"race detected during execution of test", while the fix passes
cleanly.
The session constructors only initialise structs (the CLI is not
spawned until Send), so the new tests run without requiring qodercli
or the Cursor agent binary on PATH.
- Replace hardcoded agent binary checks with AgentDoctorInfo interface
- Remove platform-specific logic from help card rendering
- Rename MarkdownToTelegramHTML to MarkdownToSimpleHTML for broader use
- Clean up core engine code to avoid platform/agent name hardcoding
- Add CLIBinaryName and CLIDisplayName methods to agent implementations
- Consolidate help card rendering logic to be platform-agnostic
generated by llmgit
Co-Authored-By: Claude <noreply@anthropic.com>