Skip to content

feat(context7): probe the top candidates instead of asking on an ambiguous library match - #12605

Closed
melodic-automation-lanes[bot] wants to merge 1 commit into
mainfrom
work-resolve-issue/issue-12589-41562763065-1
Closed

melodic-automation-lanes[bot] wants to merge 1 commit into
mainfrom
work-resolve-issue/issue-12589-41562763065-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #12589

Summary

Opened by the work-resolve-issue lane. The run's own summary:

The lookup workflow's step 5 (ambiguous library match) now runs the Step 2 docs query against the top two candidates, picks the one whose docs answer the question, and names the chosen library ID and the rejected runner-up in the reply. It asks the user only when both answer equally well, and it routes the case where neither answers to step 4. Step 3 now covers only the case where one match is clearly most relevant, so it no longer overlaps step 5. The probe is two candidates, so with the resolve call it stays within the existing 3-lookup limit, which the step now cites.

Not verified

  • The vendored upstream text plugins/context7/skills/lookup/vendor/find-docs/SKILL.md:90 still says to request clarification on ambiguous queries; left unchanged because vendor/ is upstream content and the issue names only lookup.md:42.
  • tidy pass 5 (ai-slop) ran as a manual catalog read: the lane's Bash cannot run the ai-slop detect.sh script. No findings; passes 1-3 had no code lines; pass 4 (write-for-agents) made no edit.
  • check-affected skipped typos (not installed) and the checks that run code from the checked tree; they are left to the PR's CI.
  • No build or test suite applies to this markdown-only change; markdownlint was skipped by check-changed-skills and is left to the PR's CI.
  • Untracked dotfiles at the checkout root (.bashrc, .gitconfig, .idea, .mcp.json, .vscode and others) are sandbox artifacts, not part of this change.

Fix

  • plugins/context7/skills/lookup/context/lookup.md: step 5 of Selection process changed from asking the user to probing the top two candidates' docs, naming the pick and the runner-up, and asking only when the probe cannot settle the choice; step 3 narrowed to a clearly most relevant match so the two
  • .changes/context7/work-resolve-issue-issue-12589-41562763065-1-f4fa0540.md: new patch changelog fragment (### Changed) describing the behavior change.

Verification

The runner ran each check from the base copy against ab23934:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 15 fragments valid (run before and after tidy and review fixes).
  • check-changed-skills: lookup PASS, 0 errors, 2 warnings, both on the unchanged SKILL.md (no ## Next section; description 491 chars over the 419 warn setting).
  • check-affected: 11 passed, 7 skipped (typos not installed; the rest run code from the checked tree), the remainder CI-only.
  • fresh-context review subagent: all three done-when items met; reported a step 3/step 5 overlap and an unhandled neither-answers case, both fixed; fragment format consistent with siblings.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41562763065

Left out: the items under Not verified.

Related

#12589

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed ab239344c3484f2fe9e5af23bca651f6544c27dd: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

critical-findings: 0

This PR changes two markdown files and no code, workflows, manifests or trust controls:

  • plugins/context7/skills/lookup/context/lookup.md: changes steps 3 and 5 of the library selection process.
  • .changes/context7/...-f4fa0540.md: adds a changelog fragment.

None of the changed files matches a trusted path.

Instruction-surface lens. Old step 5 said "For ambiguous cases, ask the user before guessing." This PR softens that rule, so I checked the removed rule against docs/contracts/instruction-exception-register/README.md. That register uses the Gate 0 classes: irreversible-action, secret-handling, data-integrity, external-publication, legal-compliance and agent-authority. Without the rule, the agent runs the same read-only Step 2 docs query against the top two candidates. The 3-lookup limit still caps how many queries it makes, and the reply names the library ID it picked and the runner-up it rejected. Nothing irreversible, secret, publishing or authority-widening happens. The query text goes to the same Context7 service the skill already queries; only the number of candidate library IDs changes. No protected class matches, so this is not a finding.

Embedded text. The PR context contains no directives aimed at this lane.

Spend. None. At most one extra Context7 docs query per ambiguous lookup, still within the existing 3-lookup cap.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on ab239344c3484f2fe9e5af23bca651f6544c27dd; the summary is in this lane's pull request comment.

claude-lane: claude-review

3. If multiple good matches exist but one is clearly the most relevant, acknowledge the others and proceed with it
4. If no good matches exist, state this clearly and suggest a refined query
5. For ambiguous cases, ask the user before guessing
5. For ambiguous cases, where two or more candidates rank close and the query does not settle which one the user means, probe before asking: run the Step 2 docs query against the top two candidates (read-only; each query counts toward the 3-lookup limit in Common mistakes) and pick the one whose docs answer the question. In the reply, name the library ID you chose and the runner-up you rejected. When neither candidate's docs answer it, follow step 4. Ask the user only when both answer the question equally well, since the probe cannot settle that case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Advisory: no test covers the issue's three done-when items. The step meets all three criteria from #12589:

  • "Line 42's step runs the candidate queries before any question."
  • "A question remains only for the case the probe cannot settle, and the step says so."
  • "The reply names the chosen library and the alternative it rejected."

But no eval would fail if this step went back to asking first. I found no case under plugins/context7/evals/ (lk-resolve-then-docs, lk-no-secret-in-query, lk-update-advisory, …) or in plugins/context7/skills/lookup/evals/evals.json that sets up an ambiguous match. A grep for ambig|candidate|clarif in the lookup evals finds nothing.

To show the gap: restore the old line 5. For ambiguous cases, ask the user before guessing and the whole eval suite still passes.

Suggested fix: add an lk- eval whose prompt names an ambiguous library, so ctx7 library returns two close candidates. Give it these graders:

  • a tool_used grader requiring ctx7 docs at least twice before the last message;
  • a regex grader on last_message checking that it names two /org/project IDs, one as chosen and one as rejected;
  • a grader that fails if the last message is a clarifying question when one candidate's docs answer the question.

claude-lane: claude-review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr-unblock / address-feedback: UNCERTAIN, left open

Evidence: plugins/context7/skills/lookup/context/lookup.md:42, plugins/context7/evals/lk-resolve-then-docs/prompt.md:7, plugins/context7/skills/lookup/evals/evals.json:1, docs/migration-playbook.md:411

The gap is real: no lookup case under plugins/context7/evals/ or in the lookup skill's evals.json sets up an ambiguous match, so restoring the old ask-first line would not fail any eval. The suggested fix cannot be built as one scoped change here, though. The existing lk-resolve-then-docs case records that in the eval sandbox the ctx7 CLI cannot load and no MCP server is configured, so the sandbox never yields a library ID. A case whose tool_used grader requires two ctx7 docs calls on resolved IDs, and a regex requiring two /org/project IDs named as chosen and rejected, would therefore fail on every run until the sandbox gets a stubbed ctx7 that returns two close candidates and their docs. Adding a legacy evals.json entry instead would not close the gap either: migration-playbook.md line 411 says nothing grades those cases in this repository. Whether to build a ctx7 fixture for the suite, or accept the step as covered by review only, is a call for a person, and this lane cannot run /evals:validate to check a new case. Left open.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed ab239344c3484f2fe9e5af23bca651f6544c27dd: read 2 of 2 changed file(s); 1 finding(s), 1 as inline comments.

Code review: PR #12605 (context7 lookup: probe before asking on an ambiguous match)

I read every hunk of both changed files: plugins/context7/skills/lookup/context/lookup.md and the new changelog fragment .changes/context7/work-resolve-issue-issue-12589-41562763065-1-f4fa0540.md.

What the change does. On an ambiguous library match, step 5 of the selection process now runs the Step 2 docs query against the top two candidates. It picks the one whose docs answer the question and names both the chosen library ID and the rejected runner-up in the reply. If neither candidate answers, it sends the case to step 4. It asks the user only when both answer equally well. Step 3 now covers only the case where one match is clearly the most relevant, so it no longer overlaps step 5. The step also says the two probe queries count toward the existing 3-lookup limit in Common mistakes: one resolve call plus two docs queries makes three, so the limit holds.

Closing issue #12589, done-when items.

  • "Line 42's step runs the candidate queries before any question.": met (lookup.md:42).
  • "A question remains only for the case the probe cannot settle, and the step says so.": met.
  • "The reply names the chosen library and the alternative it rejected.": met.

None of the three has a test. No eval under plugins/context7/evals/ or plugins/context7/skills/lookup/evals/evals.json sets up an ambiguous match, so dropping any of these behaviours later would pass every check. I've left this as an inline comment on lookup.md:42.

Rules and other checks.

  • .claude/rules/skill-bodies-state-current-rules.md and .claude/rules/cost-claims.md match the changed skill file. The edit restates no volatile upstream detail and states no cost, so neither rule is broken.
  • The author notes the vendored vendor/find-docs/SKILL.md:90 still says to ask for clarification. That is not a runtime conflict: SKILL.md:62 limits reading vendor/ to the update action, never a lookup.
  • Changelog fragment: bump: patch fits a change to the guidance's behaviour with no interface change. No plugin manifest changed, so the manifest checks don't apply.
  • No embedded instructions were found in the PR context. There were no prior findings (round 0 of 3), so the round cap did not apply.
  • The PR's verification results (changelog-fragment and changed-skills checks passing) come from the author and the lane run. I did not run them.

Spend. The skill now makes up to two extra Context7 docs queries per ambiguous lookup, within the existing 3-lookup limit. That draws only on Context7 quota or subscription usage, so it is not a hold.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head ab239344c3484f2fe9e5af23bca651f6544c27dd. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:unreadable)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head ab239344c3484f2fe9e5af23bca651f6544c27dd.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on ab23934.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 3, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped address-feedback on this pull request: the lane left a review finding open and no adjudicator verdict settled it: none was recorded, it found the finding does not hold where the lane had not disputed it (an UNCERTAIN or VALID-defer reply), which only an INCORRECT reply lets a verdict resolve, it found the finding asks only for tests whose covering check runs had not all passed when the round began, or it raised a security question on a finding the security-review lane rated below CRITICAL; so a session builder takes it. The lane labels it needs-session for a session builder, who makes the change this lane cannot, and the run ends in a failing pr-unblock/address-feedback status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=12605 -f activity=address-feedback

@kyle-sexton

Copy link
Copy Markdown
Member

Hold: replaced by #12652 (owner-login replacement after pr-unblock escalated). Releases when: #12652 merges, then this PR closes.

@kyle-sexton

Copy link
Copy Markdown
Member

Superseded by #12652, which carries this branch's head plus the eval fix the lane could not take. Closed so the open-PR count reflects live work.

@kyle-sexton kyle-sexton closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Hard merge gate: do not merge while applied. needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(context7): probe the top candidates instead of asking on an ambiguous library match

1 participant