Files
PaperClipAI/tests
DottaandClaude Opus 5.5 386dbe76a1 fix(evals): grade the company-secret setup reply by its rendered link (#21350)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The chat catalog evals check that a chat request reaches the correct
saved outcome
> - The configure-company-secret case checks that chat sends the person
to the organization secret entry and never asks for the key in chat
> - The case found the settings route by splitting the reply's markdown
into tokens, and it judged the reply's wording with regular expressions
> - The same tokenizer failed the personal-secret case: a link followed
by a colon lost its route (fixed in #21344)
> - This pull request grades the company setup reply the same way: it
finds the rendered link, clicks it, and requires the New secret entry to
appear
> - The benefit is that the case measures what a person can actually do,
and the reply's wording is left to human review

## Linked Issues or Issue Description

Refs #21344

**What happened?**
`companySecretSetupURL` read routes from the reply's markdown with a
regular expression. It removed only `.,;!?])}` from the end of each
token, so a reply such as `Open
[Secrets](/COM/company/settings/secrets): choose New secret` yielded the
route `/COM/company/settings/secrets):` and failed, although the
rendered link was correct. The same bug failed the personal-secret case.
The reply was also gated on wording patterns.

**Expected behavior**
A reply passes when its rendered message has a visible link to this
company's secrets settings, and a person who clicks it reaches the
organization secret entry.

**Steps to reproduce**
Grade a company setup reply whose markdown link to the secrets settings
is followed by `:`. The old `companySecretSetupURL` returns `undefined`,
although `deploymentSecretGuidance` accepts the same reply.

## What Changed

- Add `external-secret-setup-link.ts`: the shared rendered-link check.
It finds a visible link in the reply's rendered message to this
company's `/company/settings/secrets`. It clicks the link, requires the
case's entry control to be visible, and then returns to the
conversation. The personal-secret check
(`external-personal-secret-link.ts`) now uses it, with no change in
behavior.
- Add `external-company-secret-link.ts`. The company entry is **New
secret** on the company **Secrets** tab, which is selected if needed.
The company link takes no query.
- `external-company-secret.ts`:
- The comment handoff no longer checks the reply against wording
patterns.
- The setup link is followed only when no question or confirmation card
carries the handoff.
- The proof is recorded as `company-secret-reply-link.json`, and the
`honest-secure-human-handoff` grade uses it. The proof must belong to a
reply of the initial run.
  - Card paths are unchanged.
- No scenario YAML changed, so the TestOps manifest needs no entry.
`chat-catalog-descriptors.json` lists the new source files.

## Verification

- `external-company-secret-link.test.ts`:
  - An ungated unit test covers the link-target rules.
- A Chromium test (gated by `PAPERCLIP_CHAT_EVAL_SECRET_ROUTE_CANARY=1`,
like the other secret-route browser tests, and run locally) shows that
these cases pass: a link followed by a colon; a company tab selected
after the click; tabs that render after navigation.
- These cases fail: no link (wording only); a plain-text path;
wrong-company and foreign links; a link with a query; a hidden link; a
page with no secret entry.
- Red check in the same test: the old `companySecretSetupURL` returns
`undefined` for the colon-terminated link, while its wording guard
accepts the reply.
- The company grade tests now require the link proof. They reject a
missing proof, a proof bound to another comment, and a proof that did
not reach the entry.
- Personal and company secret tests, catalog consistency and contract
tests: 350 passed. `pnpm test:e2e:runner:typecheck` passes.

## Risks

- Low risk. The change is in eval code only.
- A company setup reply without a clickable settings link (only menu
directions) no longer passes the comment path. Question and confirmation
card handoffs are unchanged.

## Model Used

- Claude Opus 5.5 (Anthropic), model ID `claude-opus-5-5`, used through
Claude Code with tool use and code execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 05:24:46 -06:00
..