Skills 2026-08-10 16:01 UTC
Whale
Committed by reneleonhardt. Update Category: Bug Fixes & Stability Improvements. Commit details: fix: MCP integration robustness — server lifecycle, diagnostics, log hygiene, terminal startup hardening (#362). This update resolves known runtime errors and enhances system reliability.
CommitRaw commit message
fix: MCP integration robustness — server lifecycle, diagnostics, log hygiene, terminal startup hardening (#362) * fix(acp): Warn on baseline http servers and sanitize logged names - Baseline mcp.json servers using url transport are logged as outside the stdio-only advertisement (informational only: the baseline is user-trusted; client-supplied http servers are rejected before connect). - Client-supplied MCP server spawns (arbitrary stdio processes with the user's privileges) are logged at connect time. - Server names and errors from clients/config are sanitized before logging, closing a log-injection vector via newline control characters. Test: TestSanitizeLogName. Co-authored-by: GPT-5.6 Sol <codex@openai.com> * fix(mcp): Capture stdio server stderr from the original spawn The MCP SDK only wires the command's stdout and stdin, leaving stderr untouched. Capture it in the stdio transport so a fast server failure is diagnosed from the original spawn's output, instead of re-running the command (stdioCheck) — removing the extra spawn per failed server. Test: TestManagerCapturesStdioStderrOnFastFailure. Co-authored-by: GPT-5.6 Sol <codex@openai.com> * fix(acp): Negative-cache failed MCP servers and standardize consent refusals A server that fails to start (e.g. codemap refusing without --allow-spawn) was re-spawned on every session/new of a long-lived host. Cache failed server identities per process and skip them in later sessions, logging "previously failed, skipping". Define the standardized consent-refusal marker (MCP-CONSENT-REFUSED) that whale-ecosystem MCP servers emit when spawned without explicit consent; whale-acp matches it to log the refusal clearly. Tests: TestWireMCPServersNegativeCacheSkipsFailedServer. Co-authored-by: GPT-5.6 Sol <codex@openai.com> * fix(app): serialize sessionID access between MCP startup and session switches -race flagged App.loadPromotedToolState reading a.sessionID (MCP startup goroutine via InitializeMCP -> RestorePromotedTools) while ApplyResumeChoice writes it on the dispatch goroutine; session/new and fork write the same field unsynchronized. Add sessionMu guarding sessionID: all writers route through setSessionID (resume, session-new, fork), SessionID() reads under the lock, and the async MCP readers (writePromotedToolState, loadPromotedToolState) take a consistent sessionPath() snapshot instead of touching the fields raw. sessionsDir is immutable after construction and stays lock-free. Tests: new TestSessionIDConcurrentReadWrite (4x reader / 4x writer under -race); resume-vs-hydration service test now passes -race -count=2. * fix(app): register restored promoted tools before registry rebuild RestorePromotedTools populated the promotedTools map AFTER rebuildToolRegistriesLocked, so collectPromotedToolsLocked never saw the restored tools: the rebuild replaced the registry without them and the next rebuild pruned them as stale. Restore-on-resume was silently a no-op. promoteToolsLocked already tracks promoted tools before rebuild (its comment states the invariant); RestorePromotedTools now matches that order. Tests: new TestRestorePromotedToolsSuccess asserts the restored tool is in the registry and promotedTools map — failed before this fix. Also add unit coverage for loadPromotedToolState (missing file, stale hash, valid, malformed JSON, nil app), writePromotedToolState (nil app, empty path, round-trip), RestorePromotedTools no-state/nil paths, and the setSessionID/SessionID/sessionPath accessors. * fix(lsp): publish procDone before spawn so Close never sees it nil isStarting() turns true as soon as the starting CAS lands in Start(), before the spawn block stored c.procDone. A Close racing that window could return with procDone == nil, so TestCloseWaitsForProcessExit flaked on CI with "no process was tracked" even though the process was spawning fine. Publish the procDone channel at CAS time and close the same channel from the reaper goroutine. Once a start attempt is in flight, Close can always observe a process-tracking channel; the existing bounded wait on it keeps the reap guarantee (an unreaped process holds workspace-directory handles on Windows). Test: TestCloseWaitsForProcessExit -count=30 green; full internal/lsp -count=3 green. --------- Co-authored-by: GPT-5.6 Sol <codex@openai.com> Co-authored-by: Rene Leonhardt <rene@MacBook-Pro.local>