Files
PaperClipAI/tests
DottaandPaperclip 477323e4e8 fix(evals): attribute native saved-skill library reads (#23611)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product E2E tests check that agents use saved skills and save the
correct result.
> - The saved-skill test binds a native source read to an exact skill
version and run.
> - The native library tool can return the complete source through
`paperclip_load_skill`.
> - The test did not recognize this tool result, so it rejected a
successful read.
> - This pull request adds a closed check for that result and preserves
the independent output checks.

## Linked Issues or Issue Description

**What happened?**

The saved-skill journey rejected a successful native OpenCode library
read. Its receipt list was empty. The proxy reports `operation: unknown`
and `readOnly: false` for this tool. Retained event payloads can also
omit null targets.

**Expected behavior**

A complete source read must qualify when the saved skill, immutable
version, source bytes, admitted assignment and native call all agree.
Failed, partial, copied or foreign results must fail.

**Steps to reproduce**

Run the new library-loader test against the old parser. The valid
start/progress/completion case returns no receipt. The test expects one
receipt. The new retained-event case also fails before support for
omitted null targets.

Related public repairs: #22813 fixes assigned-skill name resolution.
[Cloud #1135](https://github.com/paperclipai/paperclip-cloud/pull/1135)
reports ordinary saved-skill assignment. Neither adds this evidence
path.

## What Changed

- Carry the saved skill ID with the selected key and version.
- Accept the native OpenCode library result only with matching IDs, key,
version, full source, SHA-256, byte count and complete single-file
inventory.
- Require the actual run, runner, native session, turn, item and one
ordered start/completion pair. Allow progress events between them. Allow
absent or null targets. Reject a supplied path.
- Share native run admission across the library, OpenCode loader and
Codex paths. Share the two OpenCode loaders' ordered call checks.
- Preserve literal numeric prefixes in verified source text. Remove
display line numbers only from file-reader output.
- Add negative cases and full-flow cases for the source read and
independent output checks. Document the accepted evidence.

## Verification

- Red: the valid library read returned an empty receipt list against the
old parser.
- Red: the retained event shape with omitted null targets failed before
that case was supported.
- Red: six new library and assigned-source cases with literal `1: `,
`2|` and `3→` prefixes fail before the review fix. Native and provider
skill-loader cases also cover these prefixes.
- Green: five focused saved-skill test files pass, with 279 tests.
- Replay of retained private events: the old receipt list is empty; the
fixed parser returns one receipt for the original completed event.
Private data stays out of this PR.
- `pnpm test:e2e:runner:typecheck` passed for the final files. The test
fixture uses mutable row types for its negative cases.
- `pnpm verify` could not select tests because the managed Git storage
guard rejected `git ls-files`. The focused tests ran directly.
- [Required
CI](https://github.com/paperclipai/paperclip/actions/runs/47113067897)
passes on c34ad477. The typecheck, all four runner-support shards,
static checks and all six runner package shards pass. The path selector
skips Build and unrelated suites for this test-only change.
- Greptile, Feynman and Ponytail each give the current head 5/5. All
four prior review threads are resolved.
- After merge, run only `saved-skill-use` in the QA staging workflow.
The original failed run remains failed.

## Risks

The main risk is a false positive from copied or incomplete tool output.
The new path requires a specific built-in tool, exact source identity
and bytes, the admitted version and a unique paired native call.
Existing file-read and Codex checks remain unchanged. Independent
document content, revision author, reload and source-preservation checks
still apply. No runtime behavior, schema, migration or selected test
plan changes.

## Model Used

OpenAI Codex, GPT-6, with reasoning, 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
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-12-03 09:39:05 -06:00
..
…