Files
PaperClipAI/maps/feature-map/agent-chat.md
T
Dotta 4553c2396b refactor(test): prune 483 redundant nightly soak test suites (keep 105 canonical) (#22831)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Over recent sprints, `scripts/ci/nightly-only-suites.json`
accumulated 588 real-clock soak, recovery, lease, and maintenance test
files totaling ~326k LOC and ~307 CPU-minutes on `master`,
`release-verify`, and `full-ci` runs.
> - Most of those files are overlapping single-PR regression soaks whose
failure modes are already covered by canonical suites, driving up
maintenance cost, typecheck load, and post-merge verification runtime
without adding distinct coverage.
> - Following `.agents/skills/test-audit/SKILL.md`, this pull request
prunes 483 redundant/overlapping soak files (`-158,485` net LOC, ~180
CPU-min saved) while retaining 105 canonical, high-signal nightly suites
covering every distinct failure mode and 100% of suites referenced by CI
workflows, benchmarks, Slack eval manifests, lifecycle inventories, or
tsconfigs.
> - All timing manifests and feature/agent-access maps are updated
cleanly to remove stale references.
> - The benefit is a ~59% reduction in nightly soak CPU time and ~158.5k
fewer lines of duplicate test code to compile, typecheck, and maintain
while preserving full invariant and canonical soak coverage.

## Linked Issues or Issue Description

Refs #22804

**What existing behavior does this improve?**
Test suite maintainability, typecheck scope, and
nightly/post-merge/full-CI runtime across
`scripts/ci/nightly-only-suites.json` and `server/src/`.

**Subsystem affected**
server/ — REST API & orchestration services

**Current behavior**
`scripts/ci/nightly-only-suites.json` contains 588 standalone soak test
files (~307 CPU-min total), with hundreds of overlapping one-PR
recovery, lease, and idle-maintenance soak suites duplicating canonical
coverage.

**Proposed behavior**
Retain 105 canonical high-signal nightly suites covering every distinct
failure mode and every hard-referenced suite, delete 483 redundant soak
files, and keep `nightly-only-suites.json`,
`general-server-shard-durations.json`, and `maps/` 100% synchronized.

## What Changed

- **Pruned 483 redundant nightly soak files (`-158,916 / +431` LOC =
`-158,485` net LOC, ~59% of nightly soak CPU):**
- Retained **105 canonical high-signal nightly suites** covering every
distinct failure mode and 100% of hard-referenced suites
(`scripts/run-vitest-stable.mjs`, `runner-chaos-evals.yml`,
`ci-work-benchmark.yml`, `tests/lifecycle-baseline/inventory.mjs`,
`stress-workflow-traceability.json`,
`packages/plugins/examples/slack/evals/cases.json`, and
`tsconfig*.json`), including the 6 focused suites restored after review
(`idle-database-backup-sync`, `isolated-remote-workspace-source-lock`,
`agent-chat-response-recovery`, `chat-slack-receipts`,
`heartbeat-slack-invitation`, `ephemeral-migration-service`).
- **Updated manifests and maps:**
- `scripts/ci/nightly-only-suites.json`: 588 → 105 suites (0 missing, 0
duplicates, 0 protected invariants demoted).
- `scripts/general-server-shard-durations.json`: 2,138 → 1,655 entries
(`coverage: { measured: 1573, withSetup: 1573, inventory: 1655 }`,
pruned all 483 deleted paths).
- Updated all affected `maps/{agent-access-map,feature-map}/*.md` files
with zero dangling references.

## Verification

- `node scripts/check-test-budget.mjs --base origin/master` — **PASS**
(105 nightly suites validated, 0 invariant violations)
- `node scripts/check-maps.mjs` — **PASS** (35 areas, 192 capability IDs
aligned)
- `node packages/plugins/examples/slack/evals/run-regressions.mjs
--list` — **PASS**
- `node --test scripts/__tests__/run-vitest-stable-shard.test.mjs
scripts/__tests__/run-vitest-stable-pr-mode.test.mjs
scripts/check-test-budget.test.mjs
scripts/ci/test-selection-pr-timings.test.mjs
scripts/ci/test-selection-timings.test.mjs
tests/lifecycle-baseline/report.test.mjs
.github/scripts/tests/ci-plan.test.mjs` — **102/102 PASS**
- Repo-wide scan confirmed 0 test-to-test imports and 0 dangling
references in `scripts/`, `.github/`, `maps/`, `tsconfig*.json`,
`packages/plugins/examples/slack/evals/cases.json`, or
`tests/lifecycle-baseline/inventory.mjs`.

## Risks

- Low risk: every deleted file was already nightly-only (not running on
ordinary PRs) and every distinct failure mode plus every core
control-plane invariant remains covered by PR suites and the 105
retained canonical nightly suites.

## Model Used

- Google Gemini (Antigravity agent swarm) with extended reasoning, tool
use, and local test execution (`server-prune`, `verifier`,
`ci-pipeline`).

## 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
2026-11-24 17:30:47 -06:00

146 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
navigation: {"section":"Tasks and conversations","sectionOrder":20,"order":40}
---
# Agent conversations and project handoff
A person can hold a persistent conversation with an agent, return to its history, and hand useful work into a project or task. The gated conference-room chat is a separate conversation surface.
Feature ID: `agent-chat`.
Implementation: [agent chat](../../ui/src/pages/AgentChat.tsx), [chat landing](../../ui/src/pages/AgentChats.tsx), [conference room](../../ui/src/pages/BoardChat.tsx).
Agent access: [companion](../agent-access-map/agent-chat.md).
## Sub-features
- `discovery`: `agent-chat/discovery` — find an agent and reopen an accessible recent conversation.
- `history`: `agent-chat/history` — send messages, inspect replies/files, and return to the same conversation.
- `handoff`: `agent-chat/handoff` — create or identify a project/task from chat and follow the resulting work.
- `conference-room`: `agent-chat/conference-room` — use the separately gated board chat without assuming parity with agent chat.
## How to get to it (user POV)
### `agent-conversation`
Task and routine results can arrive proactively in the agent's standing chat.
Each message has a source-task link; the agent row and Chat navigation indicate
unread messages, including first delivery before any human chat. Foreground
messages at the bottom of the chat are marked read with a comment cutoff.
The existing ordering and per-human/company isolation remain in effect.
Open `/chats`, choose an agent, or use `/chats/:agentRef` and its conversation sidebar.
With Coordinator enabled, click the agent avatar, name, or caret in the chat header to open the agent picker. They form one button with the same keyboard focus and action.
With Coordinator enabled, the composer exposes the shared model/thinking-level picker for supported agents. The agent stays fixed in this control; switching agents remains in the chat header. Choices save as conversation overrides on send, preserving the agent's configuration. A first message creates the conversation before saving settings and submitting through the ordered comments endpoint.
Coordinator answer receipts from this conversation jump to the answer bubble without leaving chat. Answer updates from an execution task link to that source task and its decision context. Compact document links read “Open [document title] in the sidebar”.
### `project-handoff`
Ask for project work in Agent Chat and follow its created project/task links. New tasks and accepted task suggestions default to the agent in that conversation. An explicitly requested agent or person takes precedence; no best-fit agent routing is inferred. Ordinary task creation outside chat keeps its existing assignment behavior.
### `conference-room`
Open `/board-chat` only when its conference-room gate is enabled.
## Driving it with Playwright and the Paperclip CLI
Preconditions: follow the [baseline](./README.md#before-driving-a-journey). Enable the applicable chat feature, use a configured test agent, and distinguish model replies from a mocked conversation fixture.
### `agent-conversation`
Automated: [conversation service](../../server/src/__tests__/agent-conversations.test.ts) covers persisted conversation behavior (mocked chat landing UI tests were removed; verify recent-chat routing manually or via browser checks).
Automated: [proactive delivery](../../server/src/__tests__/agent-chat-messages.test.ts)
exercises native/HTTP delivery, concurrency, retries, authority, privacy, active
turns, resets and unread cutoffs. [Read visibility](../../ui/src/hooks/useAgentChatRead.test.tsx)
checks foreground/bottom gating and unseen arrivals. The [routine digest journey](../../tests/e2e/agent-chat-messages.spec.ts)
uses real app APIs and a deterministic process agent to verify first-chat discovery,
unread state across reloads, source navigation and follow-up context. It does not
qualify live PR retrieval or a model's editorial choices.
Automated: [composer](../../ui/src/components/task-chat/TaskChatComposer.test.tsx) covers Coordinator gating and settings submission without reassignment. (Mocked `ComposerRunSettingsPicker` and `IssueDetail` UI tests for model/effort selection, canonical first/existing-chat IDs, and settings-before-comment ordering were removed; verify those UI flows manually.) These tests mock the API and do not prove provider execution with the chosen model.
Automated: [thread and composer](../../ui/src/components/TaskChatThread.test.tsx)
keeps an in-flight attachment through first-chat creation on desktop and mobile,
while initial history for an existing conversation stays deferred. The
[first-upload browser journey](../../tests/e2e/agent-chat-projects.spec.ts)
checks the visible file chip, server attachment, no premature agent run, and
attachment count after send and reload. That journey uses a simulated agent.
Manual: In a conversation with no messages, attach a file before the first
send. Confirm the same file stays in the composer after the chat is created.
Send it once, reload, and confirm the file and message remain.
Manual: Start a conversation, send a recognizable request, and inspect its reply.
Navigate away and reopen the same history. Use `/new` for a fresh session within
the same standing conversation. Test an unavailable historical agent and an
inaccessible saved conversation; verify no cross-user or cross-company history appears.
### `project-handoff`
Automated: [agent conversations](../../server/src/__tests__/agent-conversations.test.ts) and [agent chat messages](../../server/src/__tests__/agent-chat-messages.test.ts) cover canonical agent-chat contracts; live model choice and UI handoff require a manual run.
Note: a suggested task remains a proposal until acceptance, its task,
initial plan and source-chat audience are saved atomically, and retries do
not create another task. A conversation is a privacy/provenance source rather
than a structural task parent. Expected contract boundaries also include compact
canonical decision receipts, exact uploaded-artifact bindings, current task access,
reset-session boundaries, and pagination of older handoffs.
Explicit live evals: [chat feature journeys](../../tests/runner-e2e/CHAT-FEATURES.md)
send natural requests to save a backlog task or delegate an announcement. They
check project/assignee, execution or non-execution, saved output, return to chat,
and click the actual same-instance task link after reload. Registration alone
does not establish a pass. Production chat guidance uses company-prefixed relative
task links unless the platform supplied a verified absolute origin.
Manual: Ask the configured agent to create bounded project work, inspect the proposed/created target, and open the resulting task. Verify the request context and intended project survived and the task produces a useful output.
Manual: With the personal Coordinator workspace enabled, discuss a vague request
until the agent suggests a task. Confirm that no execution task exists before
acceptance. Accept it, stay in chat, and open the created card on demand. An
explicit request to create a task may create it directly under normal authority.
Approve a work product or answer a question in its task or Inbox, then return
to the originating chat. Its compact update should link to the exact recorded
decision and reviewed artifact, without needing another coordinator turn.
Approval of artifact quality alone must not publish it or complete the task.
Coordinator task clarification: create a task with only a description. When material context is missing, native task guidance asks one focused canonical question inside that task. Its actionable form is also projected into Inbox and the originating standing chat; direct user-created tasks appear in the assigned agent’s standing chat. Answer on either surface and verify the pending card/count clear and a compact recorded answer replaces it in chat. This projection is event-refreshed and does not wake another agent merely to repeat the question. Current direct-task questions survive a chat reset; their answered receipts start at the current chat boundary. The task brief remains editable context, not another stored question. Model choice and actual resumed execution still require live verification.
### `conference-room`
Automated: [board chat gate](../../server/src/__tests__/board-chat-route-feature-flag.test.ts) proves route gating, not a live conversation.
Preconditions for this entry point: `local_trusted` mode and an installed,
authenticated `claude` CLI, in addition to the Conference Room flag. These are
separate from Agent Chat's configured-agent prerequisites.
Manual: Check disabled access first, enable in the disposable instance, then send and reload a conversation. Inspect the actual responding agent and persisted history; report this result separately from Agent Chat.
## Gotchas
- Idle chat is not failed execution.
- See [steering](./steering.md) for in-flight messages and [questions](./questions-and-approvals.md) for interactions.
- An API tool test does not prove that every harness will choose the same handoff tool.
### Storybook verification
#### `conference-room`
Capability ID: `agent-chat/conference-room`.
Scope: ui
Storybook: Conference-room flag disabled, empty/history/reply, busy and explicit failure states.
Production: Exercise separate BoardChat route gate, local-trusted deployment and authenticated Claude CLI; send/reload real conversation with responding agent attribution.
Sources: Source: [BoardChat.tsx](../../ui/src/pages/BoardChat.tsx), [board-chat.ts](../../server/src/routes/board-chat.ts). Tests: [board-chat-route-feature-flag.test.ts](../../server/src/__tests__/board-chat-route-feature-flag.test.ts)
### Explicit output quality review (Coordinator functional slice)
Accepted suggestions and native explicit task creation may carry `requiredQualityReview` into the task's existing execution policy. The opt-in requirement names output slots and is separate from the existing reviewer eligibility policy. Each slot requires a canonical human verdict bound to an exact current output document revision or attachment identity. Plans, questions, file presence, model completion claims, rejected/deferred verdicts and stale versions do not satisfy it. Only a human may change an existing requirement. Quality approval does not publish or automatically complete the task. Tasks without this optional requirement retain existing completion behavior.
Owning service: `server/src/services/required-quality-review.ts`; enforcement: interaction creation, issue update, native completion feedback/finalization. Focused proof: `server/src/__tests__/required-quality-review.test.ts` plus native arbiter and chat completion delivery tests. Completion updates include bounded canonical output-decision identities for linking existing review, never worker-authored review prose. These tests do not establish unattended live provider reliability.
Attachment approval is for the exact immutable file identity. Removal or a mismatched hash invalidates that target; registering a replacement beside the approved file does not redefine its output slot. A replacement requires a fresh bound review. Document targets additionally track the current revision.