Skip to content

fix(grounding): restore the pre-existing default persona and refusal - #49

Merged
mml555 merged 4 commits into
mainfrom
fix/grounding-default-copy
Aug 7, 2026
Merged

fix(grounding): restore the pre-existing default persona and refusal#49
mml555 merged 4 commits into
mainfrom
fix/grounding-default-copy

Conversation

@mml555

@mml555 mml555 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

#40 made grounding copy configurable and also changed the defaults to neutral wording. The issue specified that defaults stay exactly as they were. This restores them.

Before this PR (from #40) Restored
persona "You are a careful assistant answering strictly from supplied source material." "You are a customer-support assistant."
refusal "…I couldn't find that in the provided sources, so I don't want to guess." "…I couldn't find that in our knowledge base… Let me connect you with a human support agent."

Why this is right beyond spec compliance

Changing a default silently rewords live, user-facing traffic on a patch upgrade. Every existing grounded deployment would have started saying something different to its users without anyone choosing that. That is not the gateway's call to make, and it is a stronger argument than the one I made for changing them.

The objection is kept, not dropped

I still think a support-desk voice is the wrong default, and the refusal promises a human handoff a deployment may have no one to honour. That is now recorded where it is actionable instead of lost:

  • the doc comments on both constants say the default is a support-desk voice, that this is wrong outside a support desk, and that the handoff cannot be honoured without one;
  • docs/configuration.md gains a "Set persona and refusal outside a support desk" note naming the claims / clinical / legal cases;
  • the tests assert the exact default strings, so a future change to them is a deliberate act with a visible diff rather than a drift.

Configurability — the actual feature from #40 — is untouched, and the tests proving an override reaches the user are unchanged.

pnpm verify green: 1262 tests.

Summary by CodeRabbit

  • New Features

    • Updated default AI grounding to use a customer-support voice.
    • Refusal responses now reference the knowledge base and offer handoff to a human support agent.
    • Non-support deployments can customize these default persona and refusal settings.
  • Documentation

    • Clarified the default persona, refusal behavior, and customization guidance in the configuration documentation.

#40 made grounding copy configurable and ALSO changed the defaults to
neutral wording. The issue specified that defaults stay exactly as they
were, and that is the right call for a stronger reason than spec
compliance: changing a default silently rewords live user-facing traffic
on a patch upgrade, which is not the gateway's decision to make.

Restored to "You are a customer-support assistant." and the refusal that
offers a human handoff.

The objection stands and is now recorded where it is actionable rather
than dropped. The doc comments and docs/configuration.md say plainly that
these defaults are a support-desk voice, that they are wrong for the
claims/clinical/legal deployments that most want grounded answers, and
that a deployment with no support desk cannot honour the handoff the
refusal promises. Such deployments set `persona` and `refusal` — which is
what #40 made possible, and what the tests here prove reaches the user.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7f14d14a-8906-49fc-8bc0-39edaade56e1

📥 Commits

Reviewing files that changed from the base of the PR and between 4e9f6ec and 016dea9.

📒 Files selected for processing (1)
  • docs/configuration.md

📝 Walkthrough

Walkthrough

The grounding defaults now use a customer-support persona and a refusal message that offers knowledge-base guidance and human support-agent handoff. Tests and configuration documentation assert and describe these defaults.

Changes

Grounding defaults

Layer / File(s) Summary
Update grounding defaults and validation
packages/api/src/modules/chat/grounding.ts, packages/api/test/grounding-config.test.ts, docs/configuration.md
The exported persona and refusal defaults now use customer-support wording. Tests assert the exact defaults. Documentation describes the defaults and override guidance for non-support deployments.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

  • mml555/modelgov#45: Updates the same grounding defaults and their tests with customer-support wording.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: restoring the default grounding persona and refusal text.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/grounding-default-copy

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/api/src/modules/chat/grounding.ts`:
- Around line 18-35: Scope the upgrade-compatibility comments for
DEFAULT_GROUNDING_PERSONA and GROUNDING_REFUSAL to state that the unchanged
wording applies only to upgrades from before grounding copy became configurable;
also update docs/configuration.md lines 355-360 to document that deployments
upgrading from `#40` may receive the restored persona and refusal wording.

In `@packages/api/test/grounding-config.test.ts`:
- Around line 55-61: Update the refusal assertion in the test “keeps the
pre-existing refusal when nothing is configured” to compare GROUNDING_REFUSAL
against the complete expected literal, matching the exact full-string assertion
used by the persona test, rather than checking only for the “human support
agent” substring.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b04e4292-c1e1-4daf-acc0-4b4a56f918b8

📥 Commits

Reviewing files that changed from the base of the PR and between 1f91495 and cfec54c.

📒 Files selected for processing (3)
  • docs/configuration.md
  • packages/api/src/modules/chat/grounding.ts
  • packages/api/test/grounding-config.test.ts

Comment thread packages/api/src/modules/chat/grounding.ts
Comment thread packages/api/test/grounding-config.test.ts Outdated
The 'upgrading alters nothing' claim held only for RELEASED versions — a
deployment tracking main between the commit that made grounding copy
configurable and this one did see the neutral wording. Scoped in both the
doc comment and docs/configuration.md.

The refusal test used toContain("human support agent"), which any other
refusal mentioning a support agent would have satisfied. Now asserts the
full literal, as the persona test already did.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/configuration.md`:
- Around line 355-357: Update the upgrade sentence in the persona/refusal
documentation to say that an upgrade from any released version does not change
the wording sent to users, preserving the existing released-version scope.
- Around line 359-360: Update the human-handoff documentation around the
support-desk warning to state that handoff requires an available support agent,
not merely a support desk. Preserve the existing warning about deployments
without a support desk.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b38b2a8f-6143-4417-b0f3-52bcb74af343

📥 Commits

Reviewing files that changed from the base of the PR and between cfec54c and 4e9f6ec.

📒 Files selected for processing (3)
  • docs/configuration.md
  • packages/api/src/modules/chat/grounding.ts
  • packages/api/test/grounding-config.test.ts

Comment thread docs/configuration.md Outdated
Comment thread docs/configuration.md Outdated
@mml555
mml555 merged commit 86c1083 into main Aug 7, 2026
16 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