paperclip/tests/e2e
Dotta f12b647ae8
fix: reliably interrupt and resume legacy message queues (#13275)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - A task can collect more messages while its agent works.
> - Legacy runners must stop the active process before they can receive
those messages.
> - The old Interrupt action cancelled the run but could leave the queue
idle and hidden.
> - Codex could also classify a cancelled run as successful or start a
fresh process after cancellation.
> - This pull request joins cancellation, preserves the provider
session, and dispatches the current queue after cleanup.
> - The benefit is reliable interruption with the saved message order,
edits, and deletions.

## Linked Issues or Issue Description

**What happened?**

Interrupt could strand a legacy message queue. The UI could hide pending
messages after the run stopped. A Codex signal exit could race the
cancellation write. A stale session warning could also trigger a fresh
process after an interrupted resume.

**Expected behavior**

Interrupt stops the active turn and sends the remaining messages once,
in their saved order. Deleted messages stay deleted. An interrupted
Codex turn keeps its session and does not restart itself.

**Steps to reproduce**

1. Assign a task to a legacy Codex agent that runs a long command.
2. Queue three messages. Edit one, discard another, and move the last
message first.
3. Click Interrupt in the queue.
4. Repeat the interruption while the resumed session runs another
command.

Related work: Refs #13160, which moves native queue steering into the
wake-queue module. This change fixes legacy interruption and keeps
native steering unchanged.

## What Changed

- Add a revision-checked, company-scoped endpoint for legacy queue
interruption.
- Promote only the requested queue after the provider stops and releases
its lease. Retry its persisted interrupt intent from the scheduler after
a promotion error or server restart.
- Keep pending legacy queues visible after a run stops. Use server state
for the interrupt result.
- Serialize owned process cancellation before classifying the adapter
result. Preserve late session and log metadata. Acknowledge cancellation
only when an actual process or process group was owned; scheduler
placeholders retain their normal release policy.
- Send Ctrl-C to legacy Codex. Prevent missing-session fallback once the
session has started.
- Add cancellation race, multi-actor queue order, durable retry, resume
fallback, and stale request regression tests. Document the behavior.

## Verification

- Real browser tests passed with legacy Codex CLI and ACP engines, using
Codex 0.153.4 and gpt-5.6-sol.
- All three automated ACP browser scenarios passed locally: immediate
Interrupt delivery, no replay of an unfinished write, and pause
requiring Resume. Updated the old test expectation that required a
separate “go” after Interrupt.
- Browser tests covered queued edits, deletion, reordering, deleting the
final message, and repeated interruption.
- Two consecutive CLI interrupts kept one provider session. Both stopped
processes exited. The final message arrived once.
- `pnpm -r typecheck` passed.
- `pnpm check:token-gates` passed.
- All 346 post-review scheduling, recovery, queue-route,
archived-company, worktree-suppression, and stale-queue regression tests
passed.
- All 318 process-recovery and durable-chat tests passed after the final
cancellation guard.
- Codex adapter, queue UI, issue-page, and OpenAPI contract tests
passed.
- `pnpm build` passed.
- Full local suite coverage completed with
`PAPERCLIP_IN_WORKTREE=false`, using the stable runner and its CI
shards: 618 general server suites, all 145 serialized server suites, and
all workspace groups. Every failing suite passed a targeted rerun after
the fixes, rebuilding the native test fixture, correcting macOS
temporary-path setup, or retrying setup/timing failures. Existing skips
remain.
- The original monolithic run reported failures before the final fixes;
its failed suites were rerun rather than rerunning all 618 suites again.
The final process-recovery/durable-chat regression run passed all 318
tests.
- All CI checks passed for `e30eaf787f23a5511a3cb3cdb5abbccab9ed001d`:
[run 34654820774, attempt
2](https://github.com/paperclipai/paperclip/actions/runs/34654820774/attempts/2),
including typecheck, build, all test shards, E2E, and canary. The
signoff and Cursor sandbox tests each hit a timeout in the initial
attempt; both suites passed locally, and both failed shards passed their
single CI rerun. All three corrected ACP browser scenarios passed in CI.
- Greptile reviewed `e30eaf787f23a5511a3cb3cdb5abbccab9ed001d`: 5/5, no
open review threads.

## Risks

Cancellation order affects local adapters. The tests cover signal exits,
graceful exits, adapter exceptions, termination errors, and cancellation
write errors. Embedded adapters keep their cancellation controls.
Ordinary run cancellation and task pause keep their distinct queue
policies. No database migration is required.

## Model Used

OpenAI Codex, GPT-6, with reasoning, tool use, browser testing, and code
execution. The exact serving model ID and context-window size are not
exposed in this session. The live test runner used OpenAI gpt-5.6-sol.

## 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-09-11 18:26:59 -05:00
..
execution-recovery fix: make task recovery durable and preserve current requests (#13075) 2026-09-09 09:14:25 -05:00
fixtures fix(runner): keep streaming after task completion tools (#13108) 2026-09-09 15:22:00 -05:00
helpers feat: make chat-style tasks the default experience (#11101) 2026-08-11 09:06:21 -07:00
in-feed-native fix(runner): keep streaming after task completion tools (#13108) 2026-09-09 15:22:00 -05:00
acp-stop-continuation.spec.ts fix: reliably interrupt and resume legacy message queues (#13275) 2026-09-11 18:26:59 -05:00
agentmail.spec.ts feat(connections): add AgentMail inboxes and email tasks (#13256) 2026-09-11 16:56:38 -05:00
app-not-connected.spec.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
application-delete-screenshot.spec.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
applications-crud.spec.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
apps-dark-mode-shots.spec.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
apps-prosumer-mcp-flow.spec.ts Simplify app connections and enable managed Google access (#12728) 2026-09-02 14:05:53 -05:00
archived-company-url.spec.ts feat(ui): bounce cold arrivals off archived company URLs, add Unarchive (#11302) 2026-08-12 21:02:12 -07:00
board-attachment-receipts.spec.ts feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
chat-adapters-ui.spec.ts feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
composer-stop.spec.ts feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
conference-room-typing-intro.spec.ts feat(onboarding): the connect step signs in from its own button (#12801) 2026-09-03 21:45:45 -07:00
connection-intents.spec.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
connection-reviews-server.ts feat: review connection actions from tasks (#13063) 2026-09-08 19:37:13 -05:00
connection-reviews.config.ts feat: review connection actions from tasks (#13063) 2026-09-08 19:37:13 -05:00
connection-reviews.spec.ts feat: review connection actions from tasks (#13063) 2026-09-08 19:37:13 -05:00
fetch-allowed-port.ts feat(mcp) [split 8/8]: add e2e coverage and operator docs (#9563) 2026-07-14 15:48:57 -05:00
legacy-failure-continuation.spec.ts fix: recover legacy Daytona startup failures from task and inbox (#13272) 2026-09-11 18:08:14 -05:00
mcp-user-stories.catalog.ts feat(mcp) [split 8/8]: add e2e coverage and operator docs (#9563) 2026-07-14 15:48:57 -05:00
mcp-user-stories.spec.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
multi-user-authenticated.spec.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
multi-user.spec.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
nux-phase4-screenshots.spec.ts feat(onboarding): first task opens as a chat with a chief of staff (#13068) 2026-09-08 20:19:14 -07:00
onboarding.spec.ts feat(agent-login): resume an active login session and permit concurrent login terminals (#12861) 2026-09-05 10:03:13 -07:00
paused-composer.spec.ts fix(tasks): require resume before sending to paused tasks (#13232) 2026-09-11 10:28:00 -05:00
pipelines-tutorial-flow.spec.ts test: port pipelines tutorial e2e (#9149) 2026-07-07 05:54:26 -05:00
planning-mode-visual-verification.spec.ts feat(onboarding): first task opens as a chat with a chief of staff (#13068) 2026-09-08 20:19:14 -07:00
playwright-composer-stop.config.ts feat(ui): add composer Stop and simplify task controls (#13104) 2026-09-09 12:18:56 -05:00
playwright-multiuser-authenticated.config.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
playwright-multiuser.config.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
playwright.config.ts fix: recover legacy Daytona startup failures from task and inbox (#13272) 2026-09-11 18:08:14 -05:00
project-repositories.spec.ts feat(projects): select multiple GitHub source repositories (#13010) 2026-09-08 08:21:28 -05:00
runner-e2e-dashboard.spec.ts feat(runner-e2e): improve matrix report browsing (#12889) 2026-09-05 07:46:05 -05:00
sidebar-takeover.spec.ts fix(ui): polish core navigation and task layout (#12793) 2026-09-03 15:35:39 -07:00
signoff-policy.spec.ts feat(issues): contain cross-issue agent side effects (#10837) 2026-08-04 13:17:49 -05:00
smoke-lab-browser-runner.mts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00
smoke-lab-p1-p4.spec.ts test(e2e): shorten and split Smoke Lab coverage (#12506) 2026-08-31 10:15:39 -05:00
smoke-lab-p5-p7.spec.ts test(e2e): shorten and split Smoke Lab coverage (#12506) 2026-08-31 10:15:39 -05:00
smoke-lab-routine-classifier.test.mts feat(mcp) [split 8/8]: add e2e coverage and operator docs (#9563) 2026-07-14 15:48:57 -05:00
smoke-lab-routine.mts feat(mcp) [split 8/8]: add e2e coverage and operator docs (#9563) 2026-07-14 15:48:57 -05:00
smoke-lab.catalog.ts feat(connections): add v3 schema core (#9958) 2026-07-21 15:16:26 -05:00
smoke-lab.shared.ts feat(apps): unify permissions and action testing (#12802) 2026-09-03 21:23:26 -05:00