Files
PaperClipAI/tests
DottaandPaperclip 00a792999c test(e2e): retain failed agent-settings task identity (#23371)
## Thinking Path

> - Paperclip lets people manage agents and their saved work.
> - Product E2E tests check whether saved agent instructions affect the
next task.
> - A failed work run must keep a failed test result.
> - The observer currently saves task identity only after the task
completes.
> - A failed run leaves no task or run ID in its retained settings
evidence.
> - This change saves the observed identity before the failure check.
> - Engineers can then find the failed run without storing raw
instruction or provider data.

## Linked Issues or Issue Description

**What happened?**

The saved-instructions journey reads a failed native run and throws
`agent_settings_native_run_failed`. Its private report then writes
`issueId: null` and `runIds: []`. The observer already read the task and
run, but loses their identity because it fills completed evidence only
after a successful wait.

**Expected behavior**

Keep the created task ID, requested run IDs and observed status/native
phase. Keep the test failed. Do not record instruction text, raw errors,
output excerpts, account configuration or provider payloads.

**Steps to reproduce**

Run the existing agent-settings flow fixture with a failed native run.
Read `agent-settings-observations.json`. Before this change its task ID
is null. The new regression fails on that value. A denied run-detail
read also loses its requested identity.

Related work: #23041 retains question-journey failure evidence. #23108
adds Skill Studio browser-step codes. #23288 changes reset and
repository observation waits. None covers the saved-instructions
observer. This change does not repair the underlying native run failure.

## What Changed

- Keep the created task identity before the first task observation.
- Save requested run IDs before detail reads. Keep status and native
phase from each completed read.
- Keep this diagnostic separate from completed evidence and all grading
checks.
- Test failed runs, denied detail reads, successful completion and
raw-data exclusion.
- Document the private evidence fields.

## Verification

- The new failed-run assertion failed before the fix: expected task ID
`task`, received null. The other nine flow checks passed.
- After the fix, 89 checks pass in `agent-settings-flow.test.ts`,
`agent-settings-evidence.test.ts` and `observation-read.test.ts`.
- Command: `pnpm exec vitest run --config
tests/runner-e2e/vitest.config.ts` with those three files.
- `pnpm test:e2e:runner:typecheck` passes on the final source.
- The real observer and private file writer ran on Linux with simulated
browser/API boundaries. Failed work still fails. A denied detail read
keeps an empty observed-runs list. No second settings save occurs after
either failure.
- `pnpm verify` could not select tests because the managed Git guard
rejects `git ls-files`. This is not a pass. Preflight installed
dependencies and built required packages, then could not find Cargo.
Focused checks ran directly.
- No hosted provider rerun or deployment was made. Local evidence does
not establish a staging pass. Hosted acceptance requires approved
harness adoption.
- Final-head CI and automated reviews are pending.

## Risks

The new record contains private task/run IDs and lifecycle fields. It
uses an explicit field projection and does not copy the full run object.
It cannot make a pending or failed run pass. The change adds no work
runs, retries, requests, settings edits or budget. Existing grading,
cleanup and public projection remain in place. This is a reporting
repair; the underlying provider or infrastructure cause remains open.

## Model Used

OpenAI Codex, GPT-6 family, with reasoning, tool use and code execution.
The runtime does not expose an exact model ID or context-window size.

## 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-12-01 15:51:36 +00:00
..