Files
PaperClipAI/tests
DottaandPaperclip 3128be7cda fix(e2e): preserve exact spacing around handoff mentions (#22825)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product journeys check that a person can hire and delegate through
chat.
> - The journey selects real agent and project mentions in the composer.
> - Each selection inserts a trailing space for the next typed word.
> - The helper then types the complete next source slice, including its
own whitespace.
> - This pull request removes the inserted space through normal keyboard
editing before continuing.
> - The benefit is one exact saved message with the existing strict
identity and count checks.

## Linked Issues or Issue Description

**What happened?**
The hiring journey saves two spaces after its agent mention and an
unwanted space before the comma after its project mention. Its exact
saved-body assertion fails after the delegated task completes. The
retained historical observation lacks the original message comparison.
This PR reproduces the spacing defect directly in the production
composer; it does not claim those missing historical inputs were
recovered.

**Expected behavior**
Normal mention selection must preserve the exact requested body,
including whitespace and punctuation, and save it exactly once.

**Steps to reproduce**
Run the production composer browser spec with the quoted checklist
reference. Before the repair, the saved message has an extra space after
each selected mention. After the repair, the body matches exactly.

**Paperclip version or commit**
Reproduced from source at 28aa32e7d7. The
affected source files were unchanged on current master before
publication.

**Deployment mode**
Local Linux Chromium control with the real production and streamlined
composers. No model or staging credentials. Related merged #22821
repairs a separate routine journey.

## What Changed

- Check the collapsed caret before removing exactly one editor-added
space. Refuse to send if the caret does not match.
- Preserve exact agent/project mention identities and the single-message
assertion.
- Retain private byte counts, SHA-256 body hashes, IDs and comparison
results before grading. Do not retain raw bodies.
- Extend the real composer test with the quoted checklist reference.
Keep wrong-agent, duplicate and missing-project rejection.

## Verification

- Red: the production composer browser check failed with extra spaces
around both mention chips.
- Green: all 6 composer browser checks pass with the corrected helper.
- All 75 focused hiring flow and evidence tests pass. A changed-body
control proves the failure receipt survives grading.
- Local test-project typecheck could not complete: the host killed the
compiler with SIGKILL. `pnpm verify --explain` could not select checks
because the managed Git storage guard rejects `git ls-files`. Neither
attempt is a pass.
- Final head `99338b2a3f0717489f09cd949353ed2d12248e3e`: [selected
CI](https://github.com/paperclipai/paperclip/actions/runs/45491682386)
passes, including Typecheck + Release Registry, four support shards, six
Runner package shards, static checks and aggregate verify. Build and
unrelated suites are skipped by the test-only path policy. Greptile is
5/5 on this head. There are no review threads. No new paid test,
protected pin update or staging deployment was made.

## Risks

- The browser helper depends on the shipped mention insertion caret
contract. A missing trailing space stops the send instead of deleting a
mention.
- The historical cause remains an inference from an independently
reproduced defect. A future full run must establish staging acceptance.

## Model Used

OpenAI GPT-6 through Codex, with reasoning, source editing, shell tools
and Chromium. The runtime does not expose a more specific model
revision.

## 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-11-24 16:05:37 -06:00
..