Skip to content

fix(workflow-executor): name the related collection when the AI picks a record - #2061

Draft
hercemer42 wants to merge 1 commit into
mainfrom
fix/load-related-record-picker-names-collection
Draft

hercemer42 wants to merge 1 commit into
mainfrom
fix/load-related-record-picker-names-collection

Conversation

@hercemer42

@hercemer42 hercemer42 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

When a Load Related Record step asks the AI to pick its record (AI-assisted or Full AI), the AI is now told which collection the candidates come from. Found while testing PRD-1693 (multiple related records), where the same prompt picks several records.

What changes

  1. The record selection names the collection. Before: the first AI call, which picks the fields to compare, was told The related records are from the "Dvd" collection., but the second, which picks the record, saw only the candidates and the request. The AI then judges whether each candidate is what the request names. PRD-1693's pick of several records uses the same prompt shape, and there, on "Pick the dvds priced above $8" over titles reading like bicycles, the AI answered "I'm not confident they are DVDs" in 3 of 6 runs and once picked none. This single-record prompt was not measured the same way, but it gives the AI the same gap. After: the record selection gets the same line as the field selection.

What a reviewer should weigh

This changes a live path: every AI-assisted and Full AI Load Related Record step goes through this prompt. Expected effect:

  • Full AI marks a correct pick as sure more often, so it loads the record instead of pausing for the operator. It still pauses when it is unsure which candidate the request means, and "none relevant" is still only offered when the AI saw every candidate.
  • AI-assisted and Full AI decline fewer candidates over doubt about what they are rather than which one is meant.

Every candidate comes from that relation by construction, so the line only tells the AI something true.

Tests

load-related-record-step-executor.test.ts: a new test reads the record-selection prompt and finds the collection line. It fails without the change (Tests: 1 failed, 104 skipped) and the file passes with it (Tests: 105 passed, 105 total).

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made: the line names the collection's display name, already sent in the field-selection prompt. No record data is added.

Squash message

fix(workflow-executor): name the related collection when the AI picks a record

The AI picking a Load Related Record step's record was not told which
collection the candidates come from, so it judged whether each one was what
the request named and marked correct picks as unsure, which makes Full AI
pause instead of loading. The record selection now names the collection, as
the field selection already did.

🤖 Generated with Claude Code

Note

Add related collection display name to AI record-selection prompt in LoadRelatedRecordStepExecutor

Passes the related collection's display name into selectBestRecordIndex and adds a system message that names the collection in the record-selection prompt. Adds a test in load-related-record-step-executor.test.ts asserting the collection-name system message is present.

Macroscope summarized 2c4fbf8.

… a record

When a Load Related Record step asks the AI to pick a record, the field
selection was told which collection the candidates come from but the record
selection was not. The AI then judged whether each candidate was what the
request named: on "the dvds priced above $8" over titles reading like
bicycles, it marked a correct pick as unsure, which makes Full AI pause
instead of loading, and could decline every candidate. The record selection
now gets the same line as the field selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qltysh

qltysh Bot commented Nov 4, 2026

Copy link
Copy Markdown

1 new issue

Tool Category Rule Count
qlty Structure Function with many parameters (count = 5): selectBestRecordIndex 1

@qltysh

qltysh Bot commented Nov 4, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant