fix: replace silent catch blocks with warn messages#77
Conversation
|
The catch-block changes are genuinely good — But this PR also includes the identity.yaml changes from #76 (the bundled diff shows Concrete ask:
After the rebase, this will merge same-day. Apologies for the carryover from #76. |
048d4c2 to
adb49d9
Compare
|
Rebased off
No identity files in the diff. Ready for same-day merge as offered. Thanks for the detailed review on both PRs — the RFC #73 direction makes sense and I'll follow up on #76 separately. |
shreyas-lyzr
left a comment
There was a problem hiding this comment.
Clean, focused fix. All five silent catch blocks are now surfaced with actionable warn messages — exactly what the CONTRIBUTING.md standard asks for.
Two small observations (not blocking):
-
gemini.tsuses bareconsole.warn(...)while the four other sites use the project-levelwarn(...)helper fromformat.ts. Worth making consistent — importwarnand use it there too so log formatting is uniform. -
The
openai.tsTODO-to-stub rename is a nice clarity win, but worth noting that it diverges slightly from the LangChain adapter (PR #81) which uses a# TODO: Implement tool logiccomment in the same generated stub. Minor, but a single canonical stub message would avoid confusion for new contributors.
Overall: the change is safe, additive, and directly improves debuggability. Good to merge.
5 silent catch {} blocks across skill-loader, skill-discovery,
and gemini adapter now log the actual error. This matches the
CONTRIBUTING.md standard: 'Error messages should help the user
fix the problem.'
Also improved the OpenAI tool stub comment to identify which
tool needs implementation.
Changed:
- skill-loader.ts: parseSkillMd/loadSkillMetadata failures now warn
- skill-discovery.ts: skill discovery/load failures now warn
- gemini.ts: hook config parse failure now warns via console.warn
- openai.ts: tool stub comment names the specific tool
Property was used in shared.ts and validate.ts but the TypeScript interface was missing the type definition, causing CI to fail.
dd02d0c to
1817b4b
Compare
|
Rebased on latest main (was 1 commit behind). All 3 CI builds passing on the new SHA. The previous approval got dismissed in the rebase — could use a re-approve when you get a chance @shreyas-lyzr 🙏 |
shreyas-lyzr
left a comment
There was a problem hiding this comment.
Clean, targeted fix. Replacing silent catch blocks with warn() calls is the right call — silent swallowing of skill parse errors was a real operational hazard.
A few observations:
-
All five changed catch blocks now use
(err as Error).message. This is safe in practice but TypeScript allows throwing non-Error values.String(err)orerr instanceof Error ? err.message : String(err)is more defensive and avoids a potential [object Object] warn in edge cases. -
The comment stub change in
openai.ts(// TODO: Implement tool logic→// Tool stub — replace with actual ${tool.name} implementation) is bundled into this PR but is unrelated to the silent-catch fix. Fine to include, but worth calling out in the PR description. -
The
loader.tschange adds afinancial_governancefield toComplianceConfig. This is also unrelated to the silent-catch fix and appears to have been included unintentionally. Worth confirming this was intended to be part of this PR.
Core fix looks good. The warn messages include the path and the error message, which is exactly what CONTRIBUTING.md asks for.
What
Replaces 5 silent
catch {}blocks with proper error logging. These catch blocks were swallowing real failures — skill parse errors, hook config issues, and discovery problems — with zero visibility for the user.The CONTRIBUTING.md standard says: "Error messages should help the user fix the problem. 'Failed to load agent.yaml: file not found at /path' is great. A bare 'Error' isn't helpful." These catch blocks didn't even give a bare error — they were completely silent.
Changes
skill-loader.tsparseSkillMdfailurewarn()with path + error messageskill-loader.tsloadSkillMetadatafailurewarn()with path + error messageskill-discovery.tswarn()with path + error messageskill-discovery.tswarn()with path + error messagegemini.tsreturn nullconsole.warn()then return nullopenai.ts# TODOWhy
Debugging silent skill or hook failures is currently impossible without adding temporary console.log calls. Users see "0 skills loaded" with no indication WHY their skills didn't parse.
Tested
npm run buildpasses (pre-existing js-yaml type issue unchanged)dist/warn()pattern fromformat.ts