fix(hooks,foraging,mcp): surface silent catch failures#495
Merged
Conversation
Rule #9: no silent failures. Every empty catch in session-start, scanner, and the foraging MCP tool now either logs [colony] <site>: <message> to stderr or carries a one-line comment explaining why tolerance is intentional (fs-stat races on missing entries, best-effort marker cleanup). A whole session 43/43 MCP call failures could previously vanish with no trace.
…e names Wrap two overlong process.stderr.write/console.error calls to satisfy biome line-length rule. Remove @colony/mcp-server from changeset (private package) and drop to the two publishable packages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
catch {}/catch (err) {}(no body) blocks withconsole.error/process.stderr.writelogging following the existing codebase patternSites changed (logged)
packages/hooks/src/handlers/session-start.ts: kickForagingScan, buildReadyClaimNudgePreface, buildAttentionBudgetSection, buildTaskPreface unreadMessages, buildSuggestionPreface (embed, findSimilarTasks, buildSuggestionPayload), resolveSuggestionEmbedder, loadSuggestionCorepackages/foraging/src/scanner.ts: scanExamplesFs readdirSyncapps/mcp-server/src/tools/foraging.ts: enrichForagingHits JSON.parseSites left intentionally silent (commented)
packages/hooks/src/handlers/session-start.ts: releaseForagingSessionStartScan (stale marker just delays next scan), readForagingSessionStartMarker (missing/malformed marker → proceed with scan)packages/foraging/src/scanner.ts: statSync in directory loop (readdir/stat race), compactExistingPaths statSync (path absent from working copy), computeRufloContentHash statSync (variant path), fileExists, directoryExistsTest plan
pnpm typecheckpassespnpm lintpassespnpm --filter @colony/hooks testpassespnpm --filter @colony/foraging testpassespnpm --filter @colony/mcp-server testpasses