fix(coding-agent): resolved PR 3562 merge fallout

This commit is contained in:
can1357
2026-06-26 17:08:53 +02:00
parent 40e56a6318
commit 80c6528c93
5 changed files with 27 additions and 16 deletions
-4
View File
@@ -7,16 +7,12 @@
- Added `grep -q`/`--quiet`/`--silent` and `-x`/`--line-regexp` to the in-process `grep` builtin used by the bash tool. `-q` suppresses all stdout and exits 0 on the first match (short-circuiting, with match status taking precedence over read errors per GNU); `-x` anchors each pattern to whole lines. Unblocks shell conditionals such as `grep -qx "$applet" <(strings bin)`.
- Added plan-mode guidance (hashline edit mode only) steering the agent to revise the plan file section-by-section with `SWAP.BLK`/`DEL.BLK`/`INS.BLK.POST` anchored on markdown headings — a heading resolves its whole section (through nested deeper headings), so the agent can rewrite, drop, or append sections without rewriting the file.
### Added
- Added `tui.renderMermaid` to control Mermaid fenced-block ASCII rendering; disabling it also removes the Mermaid diagram hint from the generated system prompt so Mermaid blocks fall back to ordinary highlighted code fences.
- Added `/resume <session-id>` in the interactive command system, reusing the existing session-id/prefix resolver while bare `/resume` still opens the selector.
### Fixed
- Fixed `/resume <session-id>` in the interactive TUI only searching the active cwd's session directory; id-prefix lookup now falls back to sessions from other cwd buckets like CLI `--resume <session-id>`.
### Fixed
- Fixed plan mode rejecting edits to plan artifacts when models refer to them by bare filenames
- Fixed absolute paths to session-owned artifacts being incorrectly routed through the editor bridge
- Fixed Windows stdio MCP wrapper chains spawning visible PowerShell/cmd windows on startup after the #3544 fix. `StdioTransport.connect()` now probes whether OMP already has an inheritable console and `resolveStdioSpawnCommand` skips `windowsHide`/`CREATE_NO_WINDOW` in that case, so `cmd.exe`/PowerShell grandchildren reuse the terminal console instead of allocating visible conhosts during MCP startup or reconnects. ([#3567](https://github.com/can1357/oh-my-pi/issues/3567))
+8 -8
View File
@@ -263,12 +263,6 @@ function getConfig(cwd: string): LspConfig {
return config;
}
function reloadConfig(cwd: string): LspConfig {
const config = loadConfig(cwd);
setIdleTimeout(config.idleTimeoutMs);
configCache.set(cwd, config);
return config;
}
function isCustomLinter(serverConfig: ServerConfig): boolean {
return Boolean(serverConfig.createClient);
@@ -2061,8 +2055,14 @@ export class LspTool implements AgentTool<typeof lspSchema, LspToolDetails, Them
}
if (action === "reload" && (isWorkspace || !resolvedFile)) {
config = reloadConfig(this.session.cwd);
const servers = getLspServers(config);
// `reload *` is the user's explicit request to re-read config from
// disk. Drop the per-cwd cache entry so `.omp/lsp.json`, root markers,
// and plugin configs added after the first LSP call become visible —
// otherwise `getConfig` returns the first observation for the rest of
// the process lifetime (#3546).
configCache.delete(this.session.cwd);
const refreshedConfig = getConfig(this.session.cwd);
const servers = getLspServers(refreshedConfig);
if (servers.length === 0) {
return {
content: [{ type: "text", text: "No language server found for this action" }],
@@ -574,9 +574,6 @@ export async function resolveResumableSession(
return { session: localMatch, scope: "local" };
}
if (sessionDir) {
return undefined;
}
const globalSessions = await listAllSessions(storage);
const globalMatch = globalSessions.find(session => sessionMatchesResumeArg(session, sessionArg));
@@ -1424,7 +1424,11 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<SlashCommandSpec> = [
runtime.ctx.showSessionSelector();
return;
}
const match = await resolveResumableSession(sessionArg, runtime.ctx.sessionManager.getCwd());
const match = await resolveResumableSession(
sessionArg,
runtime.ctx.sessionManager.getCwd(),
runtime.ctx.sessionManager.getSessionDir(),
);
if (!match) {
runtime.ctx.showError(`Session "${sessionArg}" not found`);
return;
@@ -91,6 +91,20 @@ describe("/resume slash command", () => {
expect(harness.handleResumeSession).toHaveBeenCalledWith(sessionPath);
});
it("checks the active session directory before global cwd buckets", async () => {
const currentCwd = path.join(tempDir, "current");
const customSessionDir = path.join(tempDir, "custom-sessions");
await fs.mkdir(currentCwd, { recursive: true });
const sessionPath = await writeSession("019ed699-02fb-7000-8dac-396e2f84d484", currentCwd, customSessionDir);
const harness = createRuntime(currentCwd, customSessionDir);
const handled = await executeBuiltinSlashCommand("/resume 019ed699", harness.runtime);
expect(handled).toBe(true);
expect(harness.showError).not.toHaveBeenCalled();
expect(harness.handleResumeSession).toHaveBeenCalledWith(sessionPath);
});
it("resumes a matching session id prefix from another cwd", async () => {
const currentCwd = path.join(tempDir, "current");
const otherCwd = path.join(tempDir, "other");