Skip to content

fix(modes): ticking "Reference files" in Technical Interview did not actually ground in them - #521

Merged
evinjohnn merged 1 commit into
mainfrom
fix/interview-prep-doc-grounding-switch
Aug 28, 2026
Merged

fix(modes): ticking "Reference files" in Technical Interview did not actually ground in them#521
evinjohnn merged 1 commit into
mainfrom
fix/interview-prep-doc-grounding-switch

Conversation

@evinjohnn

Copy link
Copy Markdown
Collaborator

Follow-up to #520. One line of behaviour, one flag, one suite.

The gap

#520 gave technical-interview a reference pool and put reference_files into its permitted switches, so the "Primary knowledge source" control offers it and an attached file became reachable — second-person reachability went 0/6 → 6/6.

But ModesManager.buildUserSourceContract pinned defaultOwner: 'profile' for interview-prep templates regardless of what the user ticked. So the saved contract still resolved profile_only, documentGroundedFromContract still returned false, and forceDocumentGrounding stayed off.

Measured — identical user selection, two modes:

sourceAuthority docGrounded
technical-interview + reference_files profile_only false
general + reference_files reference_files_primary true

Everything gated on that switch therefore stayed off in the one mode whose users are most likely to upload project documents: topK 6 and a 1800-token budget instead of 12/3600, no per-file floor, no answerability scoring, no section-target or positional restore, no identity block, no query normalization.

A user could ask for their reference files and be handed a materially weaker retrieval than the same files in General — which is the mode inversion the beta report described, surviving the fix that was supposed to close it.

#520's T8 commit message claimed this clause ("restores documentCentricMode routing") was delivered. It wasn't, and I didn't verify it. This is that verification, and the fix.

Upload is still not consent

The rule #520 was built around is unchanged. This reads the user's explicit switch, never the presence of a file. A mode without the tick keeps profile and behaves exactly as before — asserted for both interview-prep templates, with no switches and with profile+JD only. Non-interview templates are asserted byte-identical with the flag in either position.

⚠️ The memory-policy consequence — please read this bit

Reference-files ownership forbids Hindsight (invariant #3), so a mode the user grounds this way loses:

allowHindsight true → false cross-meeting recall off
allowPriorAssistantFacts true → false the assistant's own prior output stops counting as evidence — a fabrication vector closing, arguably a gain
allowPriorAssistantReferents stays true follow-ups still resolve ("and what about X?")

This follows from the user's own explicit choice, and the interview-prep seed comment states that document-grounded modes must not use Hindsight. It's pinned in the suite rather than left to surface later as a bug report — but it is a live behaviour change and worth your call before merge, since "Technical Interview remembers the ongoing interview" was a deliberate property.

If you'd rather keep Hindsight for grounded interview-prep modes, that needs a new authority (profile_plus_reference_files) with its own EVIDENCE_REQUIRED / CONFLICT_POLICY / memoryPolicy entries — a larger change I did not make unilaterally.

Verification

test:intelligence 2037/0 · services 3402/0 · typecheck clean.

Behind NATIVELY_RETRIEVAL_INTERVIEW_PREP_HONORS_REFERENCE_SWITCH, default ON via a literal (identical in dev/test/production), proven to reproduce the pre-fix behaviour when off.

Pure TypeScript, no process.platform branch. The suite runs under the services glob, which is Windows-advisory — so Covered by automated macOS branch tests and Requires physical Windows verification.

🤖 Generated with Claude Code

https://claude.ai/code/session_014D8QkwcTrpGVPmkWHrp4Nz

…ep modes

Follow-up to #520. T8 gave technical-interview a reference pool and put
`reference_files` into its permitted switches, so the "Primary knowledge source"
control offers it and an attached file became REACHABLE -- second-person
reachability went 0/6 to 6/6. But `buildUserSourceContract` pinned
`defaultOwner: 'profile'` for interview-prep templates REGARDLESS of what the
user ticked, so the saved contract still resolved `profile_only`,
`documentGroundedFromContract` still returned false, and `forceDocumentGrounding`
stayed off.

Measured, identical user selection, two modes:

  technical-interview + reference_files  ->  profile_only             docGrounded=false
  general             + reference_files  ->  reference_files_primary  docGrounded=true

So everything gated on that switch stayed off in the one mode whose users are
most likely to upload project documents: topK 6 and a 1800-token budget instead
of 12/3600, no per-file floor, no answerability scoring, no section-target or
positional restore, no identity block, no query normalization. A user could ask
for their reference files and be handed a materially weaker retrieval than the
same files in General -- which is the mode inversion the beta report described,
surviving the fix that was supposed to close it.

#520's commit message claimed this clause of the decision ("restores
documentCentricMode routing") was delivered. It was not, and I did not verify it.
This is that verification, and the fix.

UPLOAD IS STILL NOT CONSENT. This reads the user's EXPLICIT switch, never the
presence of a file. A mode without the tick keeps `profile` and behaves exactly
as before -- asserted for both interview-prep templates, with no switches and
with profile+JD only.

THE MEMORY-POLICY CONSEQUENCE IS REAL and is pinned in the suite rather than
left to surface as a bug report. Reference-files ownership forbids Hindsight
(invariant #3), so a mode the user grounds this way loses:

  allowHindsight            true -> FALSE   cross-meeting recall is off
  allowPriorAssistantFacts  true -> FALSE   the assistant's own prior output
                                            stops counting as evidence, which is
                                            a fabrication vector closing
  allowPriorAssistantReferents      stays TRUE, so follow-ups still resolve

That is a consequence of the user's own explicit choice, and the interview-prep
seed comment says document-grounded modes must not use Hindsight. Flagged for
the owner because it is a live behaviour change, not because it is unintended.

Behind NATIVELY_RETRIEVAL_INTERVIEW_PREP_HONORS_REFERENCE_SWITCH, default ON via
a literal, proven to reproduce the pre-fix behaviour when off. Non-interview
templates are asserted byte-identical with the flag in either position.

test:intelligence 2037/0; services 3402/0.

Reviewed but not executed on macOS and Windows (pure TypeScript, no platform
branch). The suite runs under the services glob, which is Windows-ADVISORY
(`continue-on-error`), so this is `Covered by automated macOS branch tests` and
`Requires physical Windows verification`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014D8QkwcTrpGVPmkWHrp4Nz
@github-actions

Copy link
Copy Markdown
Contributor

React Doctor found 4 issues in 1 file · 4 warnings · score 92 / 100 (Great) · vs main

4 warnings

electron/services/ModesManager.ts

  • ⚠️ L434 Chained array iterations js-combine-iterations
  • ⚠️ L1212 await inside a loop async-await-in-loop
  • ⚠️ L1243 await inside a loop async-await-in-loop
  • ⚠️ L1416 await inside a loop async-await-in-loop
⚠️ Warning: .github/workflows/react-doctor.yml is configured incorrectly. See below to fix.

React Doctor compares against main to report only the issues this pull request introduces. This run couldn't complete that comparison (usually a shallow CI checkout with no merge base), so it listed every issue in the changed files, including ones that already existed on main.

Add fetch-depth: 0 to the actions/checkout step in .github/workflows/react-doctor.yml so the checkout includes the history React Doctor needs:

 jobs:
   react-doctor:
     steps:
       - uses: actions/checkout@v5
+        with:
+          fetch-depth: 0

       - uses: millionco/react-doctor@v2

To silence this warning, set silence-missing-baseline-warning: true on the React Doctor action.

Reviewed by React Doctor for commit b41c8b9. See inline comments for fixes.

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes an explicit Reference files selection activate document-grounded retrieval for Technical Interview and Looking for Work modes, behind a default-on rollback flag. It also adds regression coverage for grounding, unchanged profile-first defaults, flag-off behavior, and the resulting memory policy.

  • Adds the interviewPrepHonorsReferenceSwitch retrieval flag.
  • Changes user-source contract construction so an interview-prep reference-files selection becomes reference-files-owned.
  • Adds tests covering both interview-prep templates and the memory-policy transition.

Confidence Score: 4/5

The source-selection regression should be fixed before merging because enabling reference files currently disables other sources the user selected at the same time.

The new ownership decision successfully activates document grounding, but its reference-files capability path forbids profile and job-description evidence even for the profile, job_description, and reference_files combination covered by the new suite.

Files Needing Attention: electron/services/ModesManager.ts

Important Files Changed

Filename Overview
electron/services/ModesManager.ts Changes interview-prep ownership when reference files are selected, but the resulting owner drops simultaneously selected profile and job-description evidence.
electron/context-intelligence/contracts/retrieval-flags.ts Adds a default-on, environment-overridable flag using the existing environment-independent retrieval flag pattern.
electron/services/tests/InterviewPrepReferenceSwitch2026_08_29.test.mjs Thoroughly covers grounding and memory-policy behavior but asserts only the resulting authority, not that co-selected profile and job-description sources remain usable.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Interview-prep source selections] --> B{Reference files selected?}
  B -->|No| C[Profile owner]
  B -->|Yes and flag enabled| D[Reference-files owner]
  D --> E[Document-grounded retrieval]
  D --> F[Reference-file capabilities]
  F --> G[Profile and JD sources forbidden]
Loading

Fix all with Greploop Fix All in Claude Code

Reviews (1): Last reviewed commit: "fix(modes): honour an explicit reference..." | Re-trigger Greptile

Comment on lines +851 to +855
const userChoseReferenceFiles = switches.includes('reference_files')
&& isRetrievalFixEnabled('interviewPrepHonorsReferenceSwitch');
const defaultOwner: ModeSourceOwner = (isInterviewPrep && !userChoseReferenceFiles)
? 'profile'
: 'reference_files';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Co-selected profile sources are forbidden

When an interview-prep mode is saved with reference_files alongside profile or job_description, this changes the owner to reference_files; the resulting capability branch forbids résumé, project, and job-description evidence, causing answers to ignore sources the user explicitly selected.

Knowledge Base Used:

Fix in Claude Code

@evinjohnn
evinjohnn merged commit 1295cfb into main Aug 28, 2026
5 checks passed
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