fix(contact): add actionable hint when fanout search all-fail with no API code#1054
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWhen all contact search fanout queries fail without a structured API error code, ChangesFanout error hint improvement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… API code In buildFanoutResponse, when every fanout query fails AND the first failure has no Lark API code (i.e. transport, parse, panic, or context-cancel), the returned ExitError was carrying an empty Hint. This is the only output.ErrWithHint call in shortcuts/ that ships an empty hint. AGENTS.md states: "every error message you write will be parsed by an AI to decide its next action. Make errors structured, actionable, and specific." An empty hint gives the agent nothing to do. Populate the hint with the actionable next step for this branch — retry, and if it persists, narrow --queries to a single term to isolate the failing input. The companion test exercises the no-code path and asserts the hint is non-empty and mentions "retry".
d36bd81 to
1f3b423
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1054 +/- ##
=======================================
Coverage 67.76% 67.76%
=======================================
Files 590 590
Lines 55194 55195 +1
=======================================
+ Hits 37400 37401 +1
Misses 14682 14682
Partials 3112 3112 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@1f3b423d34130dc1c2cdba91b477459a4fdd6469🧩 Skill updatenpx skills add Wang-Yeah623/cli#fix/contact-fanout-empty-hint -y -g |
Summary
In
shortcuts/contact/contact_search_user_fanout.go, when every fanout query fails AND the first failure has no Lark API code (transport / parse / panic / context-cancel), the returnedExitErrorwas carrying an emptyHint. This is the onlyoutput.ErrWithHintcall inshortcuts/shipping an empty hint.AGENTS.md is explicit on this:
An empty hint gives the agent nothing to do.
Changes
shortcuts/contact/contact_search_user_fanout.go: populate the hint on the no-API-code branch with the actionable next step — "retry the command; if it persists, narrow --queries to a single term to isolate the failing input". The other branch (with a real Lark code) already routes throughoutput.ErrAPIand is unchanged.shortcuts/contact/contact_search_user_test.go: addTestFanoutAssemble_AllFailed_NoCode_HasActionableHintthat asserts the returned*output.ExitErrorcarries a non-emptyDetail.Hintcontaining"retry". Confirmed it fails onmain("expected non-empty Hint so agents have a next step; got empty") and passes after the fix.Test Plan
go test ./shortcuts/contact/ -run TestFanoutAssemble— 6/6 sub-cases passgo test ./shortcuts/contact/— full package passesmain(empty Hint) and passes with the fixgo vet ./shortcuts/contact/,gofmt -l— cleanoutput.ErrAPI)Related Issues
Summary by CodeRabbit