Commit Graph
3072 Commits
Author SHA1 Message Date
DottaandPaperclip 62eddee7db Carry landed master through 18382
Preserve original owner patch sequences and all new master semantics.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:49:08 -05:00
DottaandPaperclip 110e82d2a3 Carry landed master through 18399
Preserve original owner patch sequences and all new master semantics.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:49:06 -05:00
DottaandPaperclip 9a79769c72 Merge landed cards and current native admission into retention
Preserve the original retention owner and producers alongside current native provider-pack admission, route execution-lock protection, canonical work-signal imports, and master CI/UI changes.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:46:11 -05:00
DottaandPaperclip b6b57079b9 fix: evaluate status cards on committed changes and deadlines (#18401)
Reviewed and verified at 21795e222a.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:41:59 -05:00
DottaandPaperclip 395a4fd068 Carry qualified fixture wake reason through 18382
Normal parent merge; only the qualified queued-run fixture changes. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:20:11 -05:00
DottaandPaperclip c0db98d007 Carry qualified fixture wake reason through 18399
Normal parent merge; only the qualified queued-run fixture changes. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:20:10 -05:00
DottaandPaperclip 8fc9220ff9 Carry qualified fixture wake reason through 18388
Normal parent merge; only the qualified queued-run fixture changes. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:20:10 -05:00
DottaandPaperclip 21795e222a test: specify assigned wake reason in held-read fixture
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:18:41 -05:00
DottaandPaperclip 5abe0865c6 Carry qualified queued-run fixture repair through 18382
Normal parent merge; only the qualified queued-run fixture changes. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:13:21 -05:00
DottaandPaperclip be92e67ef5 Carry qualified queued-run fixture repair through 18399
Normal parent merge; only the qualified queued-run fixture changes. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:13:21 -05:00
DottaandPaperclip 2c486ca6e5 Carry qualified queued-run fixture repair through 18388
Normal parent merge; only the qualified queued-run fixture changes. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:13:21 -05:00
DottaandPaperclip f9bf5ab36d test: await admitted legacy heartbeat executions
Use tracked execution settlement and explicit adapter-entry barriers instead of independent short polls. Add a committed-read control proving the pre-registration drain gap while preserving durable state and concurrency assertions.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 11:12:55 -05:00
DottaandPaperclip e40de0c9e8 perf(ci): refresh test weights and narrow graph dependencies (#18464)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Contributors need fast, reliable CI feedback.
> - Diff-aware CI selects test files and partitions them into runner
jobs.
> - Stale cost estimates put several slow suites on the same runner.
Broad imports also couple small tests to large modules.
> - This PR refreshes test costs, runs independent graph discovery in
parallel, and narrows three dependency boundaries.
> - Selection safeguards and CODEOWNER-only AWS routing stay in force.

## Linked Issues or Issue Description

Refs #18398. This follows the audit of [PR #18427's verification
run](https://github.com/paperclipai/paperclip/actions/runs/41169978784).

The audit found 403 selected general-server files without timing
weights. Three suites measured at 232s, 122s and 116s shared one shard
because each received a roughly 2s fallback weight. Local graph
discovery across four projects took 43.7s serially and 21.7s with two
workers. A reverse-order repeat took 37.7s serially and 22.6s with two
workers. Both comparisons produced identical selection results. This is
a local measurement, not a claim about production CI speed.

## What Changed

- Refresh general-server costs for 1,285 of 1,309 current files and
serialized costs for all 163 files from two successful protected-master
Cloud readiness runs. Retain prior costs for unmeasured files, including
dedicated chat and native-runner suites.
- Record passing server file costs, including collection, setup and
environment preparation. A weekly hosted workflow validates trusted
source runs and opens a timing-only PR. It tests shard coverage, pauses
while a refresh PR is open, and never merges automatically.
- Discover at most two project graphs concurrently in isolated,
heap-limited Node processes. Cache repeated inventory reads within one
selection. Worker errors and timeouts retain the full task plan.
- Fetch only the merge commit and parents for the selector. A real
shallow-clone regression proves the complete diff still includes more
than 300 files, renames and deletions.
- Share the identical log viewer and run details between both
AgentDetail pages. The viewer test imports the shared implementation and
runs each of its 13 distinct cases once.
- Extract the pure API error class while preserving the API client's
public exports. Import delivery work signals through their existing
narrow DB export.

## Verification

- PASS: `pnpm -r typecheck` and `pnpm build`.
- PASS: 284 CI selection, timing, shallow-diff, sharding and routing
tests.
- PASS: 74 further cache, routing and graph-proof tests.
- PASS: 94 targeted UI assertions across the viewer, run invocation, API
errors/client and progress helpers. All 76 assertions in the 12 server
suites made independently selectable also pass.
- PASS: `pnpm check:token-gates`, module-boundary checks, YAML parsing
and `git diff --check`.
- PASS: [Full PR CI and required `ci / verify`
aggregate](https://github.com/paperclipai/paperclip/actions/runs/41206683345),
including all 12 general-server shards, all nine serialized shards,
workspace groups, chat suites, Runner lanes and build checks.
- PASS: [GitHub hosted real-workspace selector and cache/routing
qualification](https://github.com/paperclipai/paperclip/actions/runs/41206683205).
- PASS: Both Greptile and Paperclip reviews are 5/5 with no actionable
findings or inline comments on `7dc65c51b8`. The PR has no merge
conflicts.
- PASS: The production refresh parser accepted all 107 structured
file-cost records from a real successful server CI job, including
setup/loading cost.
- Local `pnpm test:run` completed all six chat shards successfully. The
duplicate monolithic local run was stopped after the complete remote
suite passed; it was not completed locally.

The focused log-viewer command improved from 18.84s (26 duplicate
variant cases) to 8.49s (all 13 distinct behavior cases). The dependency
audit confirms 12 server files and the API-error test no longer need
conservative always-run retention. Repartitioning the audited PR with
the new costs changes the slowest shard from 810s to 591s of summed
historical test execution (1,124 of 1,142 files measured). This is a
workload simulation, not measured new CI wall time.

## Risks

- Two graph processes use more peak memory. Each has a 2 GiB heap limit
and a three-minute timeout. Any failure preserves the original task
plan. Real workspace qualification runs in GitHub CI.
- Historical logs contain test/hook costs only. New reporter records add
loading/setup costs after merge. The manifests identify measurement
coverage and source runs. These weights change placement, never
permission to skip tests.
- Runner load adds timing noise. The refresh uses medians and requires
at least 90% measurement coverage in each lane.
- GitHub may require approval to run checks on a PR created with
`GITHUB_TOKEN`. Refreshes remain reviewable and do not merge themselves.
- The shared viewer is a mechanical extraction. Both pages retain their
existing exports, and the behavior assertions remain covered. AWS runner
authorization is unchanged.

## Model Used

OpenAI Codex, GPT-6, with repository inspection, reasoning, code
execution and GitHub tools. The exact deployment ID and context-window
size were not exposed in this session.

## 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 references)
- [x] My branch name describes the change and contains no internal
Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass (focused checks and six
chat shards; complete suite passed in CI as detailed above)
- [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-10-31 11:05:12 -05:00
DottaandPaperclip b7f1c3769c feat(native): record verified provider-pack session admission (#18469)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Remote native sessions can use an installed pack or a retained
earlier pack.
> - The current app revision does not identify the pack that a session
admitted.
> - Core already verifies the selected pack and binds its launch
artifacts.
> - Normal run records lack a closed receipt for that admitted
selection.
> - This pull request records that receipt after session admission and
attachment.
> - Operators can compare the actual Core admission identity with their
expected pack.

## Linked Issues or Issue Description

Refs #17749 for protected provider-pack selection and #18343 for
retained controller recovery. The related OpenCode producer repair is
#18456. Those changes do not publish the closed run receipt added here.
A search found no existing `nativeProviderPackAdmission` PR.

**What happened?**

Core can admit a compatible installed provider pack with a source
revision that differs from the current app. A retained session can also
keep its original pack. The normal run record does not show the admitted
pack digest, proxy digest, and source revision. An expected launch path
or current app revision cannot fill that evidence gap.

**Expected behavior**

The run has a closed, server-owned receipt after actual session
admission and attachment. The first receipt remains immutable history. A
separate current-proof state verifies only the actual current admission
epoch. Retained recovery needs positive original provenance, and missing
legacy evidence stays unknown.

**Steps to reproduce**

1. Select and verify an installed pack whose digest differs from the
current app pack.
2. Open the native session successfully.
3. Inspect the normal run profile for a bound admission receipt.

**Paperclip version or commit**

The original selected base was
`8bcc5a01edd5d87540401521e6f30d3df43e1848`. The branch now includes
exact actual prerequisite parent
`3ee4c5b6138da82d0b1f51aa010540561bf43c22`; the PR diff against it is
the five receipt, executor, test and documentation files.

**Deployment mode**

Core remote native execution with provider-pack selection and retained
session attachment.

## What Changed

- Retain the verified selected pack identity only after a backend
returns the matching admitted session.
- Publish `runnerProfileJson.nativeProviderPackAdmission` from the
session callback after attachment succeeds.
- Mark the receipt with `stage: session_admitted` and `authority:
core_verified_selection`.
- Store bound company, agent, run, session, runner, logical
`runnerEnvironmentLeaseId`, pack digest, OpenCode proxy digest, and
source revision fields. Retained attachments identify
`inheritedFromRunId`. The logical Runner scope is distinct from the
physical environment lease.
- Lock the current coordinator claim before the profile write. Check
owner, attempt, generation, controller boot, lease expiry, phase, and
absence of an accepted result. Merge JSON fields without replacing other
profile data.
- Restore retained metadata only from the exact prior closed Core
receipt, positively verified prior state and matching retained binding.
Capture same-run prior provenance from the locked claim row before
invalidation; cross-run recovery reads only the exact source. Legacy
absence remains unknown while recovery continues.
- Preserve the first receipt as history. Atomically mark a new opaque
admission epoch pending in the existing mandatory claim transaction.
Publish current verification only for the matching claim and epoch after
actual attachment; changed or unsupported admission becomes unknown
without blocking authorized execution.
- Preserve synchronous session publication and quarantine ordering
before the best-effort receipt write. Fresh replacement selects its
newly verified pack; a captured retained-process flag cannot relabel the
replacement with an older pack. Preserve the existing private pack
authority even when a local dirty revision is ineligible for the closed
receipt.
- Add focused admission, recovery, identity, PostgreSQL ownership, lock,
and JSON-preservation tests. Document the receipt contract.

## Verification

- RED: the actual managed-backend path verified and admitted an
installed pack but had no closed metadata. Failed open published no
evidence. Additional controls fail when retained recovery invents
missing history or dirty-revision eligibility gates the existing private
authority.
- RED calibration: removing mandatory pending invalidation fails the
actual pre-admission control; reusing the retained flag for fresh
replacement falsely restores the old pack. Removing the epoch fence
fails the real PostgreSQL stale-callback case; reintroducing a
receipt-specific execution error fails both authorized
Runner/logical-lease replacement controls.
- GREEN: 49 focused Core tests, all 33 admission identity/transaction
tests (20 pure and 13 PostgreSQL), and all 23 existing private-authority
tests passed on exact integrated head
`165a9096cf3e0d34d2db1e6b52960ad4ac0ad132`. No all-skipped run is
counted.
- Final test-only head `11ac34baf00552a5d322b5f5f1a8e491859cacec` adds
the positive executor-callback SQL-writer wiring control, exact
session/identity/claim/epoch assertions, profile preservation, and
null-session zero-write check. Removing only the production writer call
makes it fail on a missing receipt. All70 focused identity/Core tests
pass with this closure; production code, the13 PostgreSQL tests and
the23 private-authority tests are byte-identical to the qualified165
source (106 distinct passing controls across the combined proof).
- The PostgreSQL tests used an owned loopback-only cached Postgres 17
container with the supported `PAPERCLIP_TEST_POSTGRES_ADMIN_URL` helper
and aliases to current DB/shared source. The container was removed
afterward. They cover immutable history, JSON preservation, stale claims
and epochs, expired leases, terminal runs, changed/unsupported
replacements, and a failed write retaining pending proof.
- Historical pushed `f7f12fe` CI executed all 24 earlier admission
tests, including nine PostgreSQL cases, in server5. Its warm-quarantine
failure exposed the new hook-ordering issue fixed here. The same run
also encountered a six-character UUID fixture-prefix collision and the
independently repaired cached issue-link browser selector; those
historical failures are not claimed as green.
- Node 24.22.2 and Vitest 5.0.3. The credential-free normal QA runtime
import preflight passes with networking disabled. Map contracts, token
gates and `git diff --check` pass.
- Local TypeScript validation still sees stale borrowed Runner/shared
declaration mismatches outside the changed ranges. No diagnostics remain
in the new helper or changed test/hook ranges; clean current-head CI is
required.
- Repository-wide typecheck, full tests and build were not completed
locally. A full local executor attempt reached this host's unsupported
native PostgreSQL listener and was interrupted; its result is not
counted. Canonical run `41214512239`, attempt 2, is successful on exact
final head `11ac34baf00552a5d322b5f5f1a8e491859cacec`. All 59 checks are
terminal: 55 success, 3 skipped and 1 neutral; none failed or pending.
The actual Linux suites execute all 33 admission tests (including 13
PostgreSQL cases) and all 1,022 executor tests successfully. The
[original five failures and bounded unchanged-source
controls](https://github.com/paperclipai/paperclip/pull/18469#issuecomment-6545593767)
remain preserved. One failed-only request was made; GitHub expanded the
reusable workflow call and dependents. No second request was made. Fresh
exact-head Greptile review is 5/5, all review threads are resolved, and
the PR is mergeable.
- These local results claim no live provider admission, rollout or
recovery.

## Risks

- The authority is Core's verified selection plus successful session
admission. It is not an independent provider statement or continuous
runtime measurement.
- Receipt fields cannot grant execution or replace the existing
provider, process, lease, workspace, or recovery checks.
- Legacy missing receipts and unavailable database reads remain unknown.
The current release cannot label an older admitted pack.
- The closed receipt requires a clean, 40-character hexadecimal source
revision. Verified local `-dirty` packs still execute and retain their
existing private recovery authority; their closed admission proof stays
`unknown`, so it cannot certify an immutable source revision.
- The first receipt is historical. Consumers must require current state
`verified`; pending or unknown cannot certify the current pack. Changed
Runner scope or pack evidence does not add execution policy.
- A receipt save failure leaves the atomically invalidated state
pending. The existing artifact authority, cancellation, workspace and
process checks remain responsible for execution safety.
- The receipt adds no manifest, environment, credential, or filesystem
path to the run record.

## Model Used

- OpenAI GPT-6 through Codex, with reasoning, code editing, and tool
use. The session does not expose an exact model build ID or
context-window capacity.

## 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 references)
- [x] My branch name describes the change 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-10-31 10:59:24 -05:00
Devin FoleyandPaperclip 51ea624344 fix(server): reject a native run's own task status change (#18411)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Native runs (the Paperclip Runner) report their outcome with
`paperclip_finish` or `paperclip_block`, and the status arbiter then
sets the task status
> - Every runner tool, `paperclip_finish` included, requires that the
task's `executionRunId` is the current run
> - When the run sends its own status change through `PATCH
/api/issues/{id}` (for example with `call_api`), the issue update clears
`executionRunId` and `checkoutRunId`, so the run removes its own
execution lock
> - After that, every tool call fails, the run cannot report, same-run
recovery spends its retries, and the task goes to `blocked`
> - This pull request rejects that status change with a 409 before it
commits, and the message tells the run to report with `paperclip_finish`
or `paperclip_block`
> - The benefit is that the run corrects itself in the same turn, and
the task does not get stuck

## Linked Issues or Issue Description

No public issue exists. This is the bug description.

**What happened?**

An agent on the Paperclip Runner followed task instructions that said
"set the task to `in_review` and keep it assigned to yourself" while it
waited on a scheduled monitor. It sent `call_api` with `PATCH
/api/issues/{id}` and `{ "status": "in_review" }`. The server applied
the change and cleared the execution lock. Then:

1. `get_task`, `set_task_monitor`, and `paperclip_finish` all failed the
run binding check. The provider saw only "Paperclip semantic operation
failed", or the monitor-wait message from `paperclip_finish`.
2. The `call_api` receipt for the PATCH showed `status: null, outcome:
unknown`, because the authority check after the response failed when the
lock was gone.
3. The session ended with no semantic result. Exact-checkpoint resume
ran out of retries (`native_session_retry_exhausted`), and recovery
would not replay the run because the mutation outcome was unknown. The
task went to `blocked`.

This occurred on each check where the agent tried the status change.
Runs that did not try it completed normally.

**Expected behavior**

A native run that holds the task's execution lock cannot remove its own
lock. It gets a clear, actionable error and reports its outcome through
`paperclip_finish` or `paperclip_block`.

**Steps to reproduce**

1. Assign a task to an agent that uses the Paperclip Runner (native
runtime).
2. While the run executes, have it send `call_api` with `PATCH
/api/issues/{id}` and `{ "status": "in_review" }` for its own task.
3. Look at the next tool calls of the run. They fail, `paperclip_finish`
cannot complete, and recovery blocks the task.

**Paperclip version or commit**

`master` at 493e229d93.

## What Changed

- `server/src/routes/issues.ts`: add
`assertNativeRunKeepsOwnExecutionLock` to `PATCH /issues/:id`. The guard
returns 409 `native_run_status_reported_by_finish` when all of these are
true:
- the actor is the assigned agent, and its run is the task's execution
or checkout run
  - the run is `native` and `running`
  - the request changes the status and keeps the assignment
  - the task is not a conversation
- The 409 message names `paperclip_finish` (`needs_review`, `done`, or
`yielded` with a `monitor` continuation) and `paperclip_block`.
`call_api` returns HTTP denials as data, so the provider can read the
message.
- Conversation tasks are out of scope. A conversation turn settles from
its final reply (`nativeConversationReplyResult`), not from a runner
tool. So a reply that moves its conversation to `in_review` still
settles, and that contract stays.
- When the request also carries blockers, the guard first runs
`assertOnboardingFirstTaskDependenciesAllowed`. A blocker that the
dependency rules reject keeps its specific 400. Every other case gets
the 409, including `{ "status": "todo", "blockedByIssueIds": [] }`.
- `server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts`:
add 14 cases. They cover rejection for `in_review`, `done`, and
`blocked` (also with an explicit self-assignment, an empty blocker list,
and a real blocker), and the onboarding 400 that wins over the 409.
Pass-through cases assert a 200, the patched status, and one update for:
other field edits, legacy runs, native runs without the lock, stopped
runs, handoffs to a human (after a confirmed stop), conversation
replies, and board users.

## Verification

- `npx vitest run
server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts`
passes (193 tests).
- With the guard disabled, the 4 rejection cases fail. With the `native`
runtime condition removed, the legacy pass-through case fails. The tests
pin both sides.
- `chat-project-tools` and `onboarding-first-task-admission` pass (74
tests). These are the integration suites that caught the first version
of the guard in CI.
- `npx vitest run` on `issue-queued-comments-routes`,
`task-workspace-binding`, and `issue-recovery-actions` together with the
ownership suite passes (455 tests).
- `npx tsc --noEmit -p server/tsconfig.json` is clean after `pnpm
--filter @paperclipai/paperclip-runner build`.

## Risks

- Behavior changes only for native runs that change the status of the
task whose execution lock they hold. That change always stranded the run
before this PR, so no working flow depends on it.
- Legacy adapters, board users, agent handoffs or reassignments, and
conversation tasks do not change.
- Other validation errors that run later (in the service update) are
replaced by the 409 for these requests. Each request is still rejected,
and the 409 points the run to `paperclip_finish` or `paperclip_block`.
The onboarding parent-blocker error keeps its 400, because the guard
runs that check first.
- If a request names the current assignee with a reference that is not
its id, the guard does not apply, and the request follows the earlier
rules.
- No migration.

Related gaps this PR does not change:
- The authority check after the response turns a committed mutation into
`outcome: unknown`.
- The runner hides tool binding errors as "Paperclip semantic operation
failed".
- The `paperclip_finish` monitor-wait error does not say that the run
lost its lock.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with
tool use (shell, file edits, test runs). It did the root-cause analysis
from run events and the activity log, wrote the code and tests, and ran
local verification.

## 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
- [ ] 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-10-31 08:44:44 -07:00
DottaandPaperclip 044f4f670b Carry qualified card interval label repair through 18382
Normal parent merge; only the two qualified card interval paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:38:36 -05:00
DottaandPaperclip 4a685a8ca4 Carry qualified card interval label repair through 18399
Normal parent merge; only the two qualified card interval paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:38:36 -05:00
DottaandPaperclip 674036e758 Carry qualified card interval label repair through 18388
Normal parent merge; only the two qualified card interval paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:38:35 -05:00
DottaandPaperclip 8c99d86e16 Label interval summary writeback with its refresh deadline
Keep membership provenance from describing an interval-owned evaluation deadline; retain existing cadence and source handling.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:37:56 -05:00
DottaandPaperclip 4c3bb2946d Carry qualified card search repair through 18382
Normal parent merge; only the five qualified card/search paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:33:38 -05:00
DottaandPaperclip bd78176b40 Carry qualified card search repair through 18399
Normal parent merge; only the five qualified card/search paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:33:38 -05:00
DottaandPaperclip d2ef6c81d0 Carry qualified card search repair through 18388
Normal parent merge; only the five qualified card/search paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:33:37 -05:00
DottaandPaperclip e0986ac344 Paginate watched status-card issues before unrelated search results
Add an internal result-kind constraint owned by company search, preserving all/comments/documents task matching and default mixed search. Apply it to card snapshots and preview without unrelated entity producer fanout.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:30:16 -05:00
DottaandPaperclip 74a3b3c129 Carry final qualified cards repair through 18382
Normal parent merge; only the three qualified status-card paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:19:44 -05:00
DottaandPaperclip 3dc77ca942 Carry final qualified cards repair through 18399
Normal parent merge; only the three qualified status-card paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:19:43 -05:00
DottaandPaperclip 42ece47d98 Carry final qualified cards repair through 18388
Normal parent merge; only the three qualified status-card paths change. Preserve every other owned and upstream blob.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:19:43 -05:00
DottaandPaperclip 9a9668425b Preserve completed shared status-card refresh generations
Guard stale cleanup with the durable generation ledger and a transaction-bound canonical cancellation. Coalesce the original completed manual request, retain future manual work, and preserve one-connection and outer-commit effects.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:18:18 -05:00
DottaandPaperclip 3ee4c5b613 Make saved execution receipt recovery react to durable work (#18409)
Reviewed and verified at 8f306e0a6e.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 10:03:59 -05:00
DottaandPaperclip 42fd568cf8 Drive issue recovery from committed changes and exact deadlines (#18402)
Reviewed and verified at 11b49125db.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:41:27 -05:00
DottaandPaperclip f0abcbb18e Carry qualified cards repair through merge confirmations
Keep the complete confirmation owner and latest routine parent intact.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:31:16 -05:00
DottaandPaperclip 508115ef70 Carry qualified cards repair through routine status work
Preserve the complete routine status slice and additive retention ownership.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:30:58 -05:00
DottaandPaperclip 8e414f54f4 Merge final cards revision ownership and parent acceptance
Co-Authored-By: Paperclip <noreply@paperclip.ing>

* fix/sleep-merge-18401:
  Scope status-card refresh tasks to their claim revision
  test(chat): retain completion identity before link metadata loads
  test(chat): locate completion through its rendered task link
  fix(chat): recover committed native Agent Chat replies (#18465)
  perf(heartbeat): drive retry promotion from durable deadlines (#18387)
  fix(ui): make the Coordinator composer footer opaque (#18455)
  fix(testops): verify unexpanded result job runs (#18462)
  fix(runner): preserve OpenCode written-answer defaults (#18456)
  fix(native): fence retries when replaying an audited Stop (#18457)
  test: await async outcomes and drive saved deadlines deterministically (#18416)
2026-10-31 09:29:14 -05:00
DottaandPaperclip 37bbb20cda Merge final deferred execution acceptance and locator proof
Co-Authored-By: Paperclip <noreply@paperclip.ing>

* commit 'd6d0b67e8a7574ee63271bbc49e6b207a3065e80':
  test(chat): retain completion identity before link metadata loads
  test(chat): locate completion through its rendered task link
  fix(chat): recover committed native Agent Chat replies (#18465)
  perf(heartbeat): drive retry promotion from durable deadlines (#18387)
  fix(ui): make the Coordinator composer footer opaque (#18455)
  fix(testops): verify unexpanded result job runs (#18462)
  fix(runner): preserve OpenCode written-answer defaults (#18456)
  fix(native): fence retries when replaying an audited Stop (#18457)
  test: await async outcomes and drive saved deadlines deterministically (#18416)
2026-10-31 09:29:00 -05:00
DottaandPaperclip 1d800abd49 Scope status-card refresh tasks to their claim revision
Keep concurrent refreshes of one revision deduplicated while preventing a superseded refresh from cancelling a newer revision task before its claim.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:26:46 -05:00
DottaandPaperclip d6d0b67e8a Merge current master native chat recovery into deferred receipts
Co-Authored-By: Paperclip <noreply@paperclip.ing>

* commit '11b49125db5ea1b274e69faf9d1abe057cdbb551':
  fix(chat): recover committed native Agent Chat replies (#18465)
  perf(heartbeat): drive retry promotion from durable deadlines (#18387)
  fix(ui): make the Coordinator composer footer opaque (#18455)
  fix(testops): verify unexpanded result job runs (#18462)
  fix(runner): preserve OpenCode written-answer defaults (#18456)
  fix(native): fence retries when replaying an audited Stop (#18457)
  test: await async outcomes and drive saved deadlines deterministically (#18416)
2026-10-31 09:22:28 -05:00
DottaandPaperclip 11b49125db Merge current master into scoped issue recovery work
Retain scoped recovery registration and producer gates while preserving landed audited-Stop retry fencing and committed native Agent Chat response recovery.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:19:17 -05:00
DottaandPaperclip cc25f28525 Merge qualified routine parent into merge confirmation work
Preserve confirmation candidates and notification ownership alongside the current routine, native, security, and retention changes.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:10:30 -05:00
Dotta 12b0cc6304 fix(chat): recover committed native Agent Chat replies (#18465)
## Thinking Path

> - Paperclip manages agent work and keeps its results available to
users.
> - Agent Chat needs a visible reply before the conversation can wait
for more input.
> - Native result commitment and reply presentation are separate
obligations.
> - A completed conversation can retain a valid final message without a
saved reply.
> - Existing reply recovery excludes these completed conversation turns.
> - This pull request repairs that persistence gap through the existing
recovery worker.

## Linked Issues or Issue Description

**What happened?**

A native Agent Chat turn completed successfully and saved its workspace.
Its accepted result and final assistant message were durable, but no
reply appeared in the conversation. The chat stayed active. The
deployment hiring journey in #18351 then reached its deadline while
waiting for the first reply.

**Expected behavior**

Recover the exact accepted turn's final reply once, then use normal
conversation settlement. Keep later user input active. Do not run the
agent again or replace a selected or deleted reply.

**Steps to reproduce**

1. Create an active conversation with one admitted native turn.
2. Commit an accepted DONE result and a final-channel assistant message
for that exact run, session and turn.
3. Finish workspace finalization before live heartbeat reply
presentation. Leave no saved reply.
4. Run normal response recovery. Before this fix it finds no
conversation candidate and leaves the chat active.

**Paperclip version or commit**

Reproduced with actual services at frozen master
`8bcc5a01edd5d87540401521e6f30d3df43e1848`. The production predicate
also exists in the deployed revision that exposed the failure.

Related work: #18351. The broader receipt and recovery work in #18118
and #18409 does not touch these source files.

## What Changed

- Discover unanswered committed Agent Chat turns through the existing
native response presentation worker.
- Recheck company, agent, responsible user, current execution and
conversation generation under the normal transaction locks.
- Require the accepted result digest and an exact final message from the
same native run, session and accepted turn. Keep external publication
authority separate.
- Commit the reply and presentation receipt before normal conversation
settlement. Later input stays active. Recovery does not repeat agent
work.
- Preserve skip decisions and selected or deleted replies. Add database
controls for foreign identity, stale sessions, partial commitment,
duplicates and ordinary internal task behavior.
- Document the recovery boundary in the developer guide.

## Verification

- Real-service RED/GREEN uses all 418 canonical migrations in isolated
PGlite and the exact new regression fixture. Before the fix: zero
candidates, no reply, recovery returns false and the chat stays active.
After the fix: one candidate, one exact reply, recovery returns true and
the chat waits. A repeat returns false and creates no second reply.
- All 20 canonical regression cases pass locally through a fixture-only
PGlite bridge. Only local database provisioning and `createDb` selection
differ from the normal embedded PostgreSQL fixture. Production services,
SQL queries, transactions, protocol validation and assertions remain
real. Linux embedded PostgreSQL CI is required before merge.
- Focused current-source no-emit typing passes for both production
modules and the new regression file, with normal Express augmentation
and source aliases. The broader local presentation/ownership and
conversation-settlement PGlite bridge run was interrupted before it
reported results; it is not counted as a pass. No repository-wide local
build is claimed from borrowed workspace dependencies. Clean-build CI
and canonical PostgreSQL consumer tests remain required.
- `git diff --check` and the scoped source/test secret scan pass. No
captured run data, credentials or private target identities are
committed.
- No live journey retry, deployment, configuration change or test-plan
admission was performed. The original failed journey remains failed;
this production fix still needs deployed qualification through the
unchanged journey.

- Current-head [canonical Linux
CI](https://github.com/paperclipai/paperclip/actions/runs/41207018345)
passed all 57 terminal checks with no failure or pending check. The new
20-case database regression actually passed in [server shard
8](https://github.com/paperclipai/paperclip/actions/runs/41207018345/job/124555006090),
at 13:59:25 UTC (2,643 ms). Typecheck, build and the existing consumer
lanes passed. Fresh [Greptile
review](https://github.com/paperclipai/paperclip/pull/18465#issuecomment-6544208002)
on exact `f32a432e10b377ae6277d6f728995d5fedcf9d7b` is 5/5; the
review-thread inventory is empty with no pagination. No live deployment
or journey pass is claimed by these checks.

## Risks

Eligible active conversations can gain a previously missing reply.
Recovery accepts only the exact saved final message under its accepted
result and current conversation identity. It does not run a model,
repeat hiring or change a prior test grade. Reply persistence precedes
waiting-state settlement; existing conversation recovery retains
ownership of a later interrupted settlement. No schema or public API
changes are included.

## Model Used

OpenAI Codex, GPT-6 family. The session does not expose a more specific
backend model ID or fixed context window. Used reasoning, repository
tools, TypeScript and real database test 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
2026-10-31 09:08:20 -05:00
DottaandPaperclip 63c77102a8 Merge qualified retention parent into routine status work
Preserve routine status producers alongside current native, security, retention, and deferred execution owners.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:08:08 -05:00
DottaandPaperclip baf651c8d0 perf(heartbeat): drive retry promotion from durable deadlines (#18387)
Reviewed and verified at f1c48c924d.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 09:07:52 -05:00
DottaandPaperclip 18c2fc767d Merge final saved-receipt test qualification through cards
Carry only the qualified C1 fixture update; preserve retention and migration runtime inputs.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* commit '8179a607ea2ec4858c29c8ae1f29ea196dbb48b8':
  test(server): observe restored Retry before draining unrelated work
2026-10-31 08:55:30 -05:00
DottaandPaperclip 8179a607ea Merge qualified saved-receipt readiness controls through the recovery parent
Carry only the final C1 test fixture and unrelated-process regression. Preserve all status-card, migration and runtime inputs.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* commit '939b90abe3f455762185110e42918ae379af6e64':
  test(server): observe restored Retry before draining unrelated work
2026-10-31 08:54:28 -05:00
DottaandPaperclip 939b90abe3 test(server): observe restored Retry before draining unrelated work
Prove a completed saved Retry remains observable while another real process holds the global drain open. Preserve exact target completion, stdout, execution count, deadline and final quiet assertions, and always release the held provider before teardown. Align two inherited fixture literals with current types.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 08:53:30 -05:00
DottaandPaperclip aab54d5bec Merge current master and generated card schema into attention retention
Preserve master attention, issue, native cleanup and tool authority changes alongside the exact reviewed retention patch. Keep bounded blocker facts, finalization precedence, source locks, archive eligibility and producer intent unchanged. Publication remains dependent on the parent qualification.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 08:51:00 -05:00
DottaandPaperclip 56f8ff7bd5 Merge current recovery and regenerate status-card migration after master 0419
Preserve the published concurrent comment uniqueness and read-state backfill migration. Regenerate the combined schema as migration0420 with the repository workflow and retain five snapshots. Add both upgrade-path controls without changing status-card execution policy.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 08:39:44 -05:00
Dotta 3549fad1dc Merge commit '0b4e48be9b881484dc5c48225a3b501595329ce2' into codex/sleep-merge-18409
* commit '0b4e48be9b881484dc5c48225a3b501595329ce2':
  fix(ui): retain startup autosave through session recovery (#18412)
  perf(server): recover independent native replies concurrently (#18421)
  perf(chat): scope task questions and batch inbox queue checks (#18422)
  fix(native): recover controllers across webserver replacement (#18343)
  fix(ui): restore task document authoring and add persistence journey (#18356)
  fix(tools): stabilize tied profile entry order (#18427)
  fix(adapter-utils): tolerate entries removed during workspace snapshots (#18426)
  test(runner): qualify Kimi Code lifecycle and recovery (#18029)
  feat(runner): deliver native Kimi Code (#18391)
  Preserve selected Google services when setup resumes (#18048)
  feat(runner): add pinned Kimi Code native runtime (#18028)
  fix(ui): show agent-created subtasks inline in the task feed (#18320)
  fix(evals): preserve opaque TestOps parameters (#18394)
  feat(chat): deliver proactive task messages to agent chats (#18374)
  fix(ci): track repository inputs across test projects (#18398)
  chore(lockfile): refresh pnpm-lock.yaml (#18414)
  fix(runner): build on Windows and add a Windows CI lane (#18250)
2026-10-31 08:27:30 -05:00
DottaandPaperclip 12d8c3043e fix(native): fence retries when replaying an audited Stop (#18457)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Native runs keep Stop intent and retry state in durable records.
> - A provider error can leave a failed retry with an earlier
acknowledged Stop.
> - The replay path returned the existing receipt before it closed that
retry.
> - This pull request applies the existing retry fence to the validated
replay.
> - The same Stop can settle without another provider cancellation or a
new receipt.

## Linked Issues or Issue Description

Refs #14733 for the related caller-bound Stop contract. This change
covers a later retry that already has a Stop acknowledgement. The older
CI-only #14743 is not a production delivery PR.

**What happened?**

A failed native run can have a retryable coordinator and an earlier
audited Stop. A repeat Stop returns the old acknowledgement without
moving the coordinator to `terminal_failure`. The final
failed-to-cancelled transition requires that fence, so the Stop cannot
settle through that path.

**Expected behavior**

A valid replay closes the same retry and keeps the original intent and
acknowledgement. It does not send a second provider cancellation.
Physical stop and workspace cleanup still require their own evidence.

**Steps to reproduce**

1. Store a failed native run with a `retryable_failure` coordinator.
2. Store a matching run-scoped Stop with a dispatched acknowledgement
and audit IDs.
3. Call `cancelNativeSession` for that same run and inspect the
coordinator.

**Paperclip version or commit**

Reproduced on public master `f2db909393de124caf6a5380a52d4e0e1d621661`.

**Deployment mode**

Core native execution. The regression uses the real cancellation
executor with controlled persistence and provider boundaries.

## What Changed

- Reuse the existing guarded coordinator fence for a validated Stop
replay.
- Test repeated replay, unchanged receipts, one fence, and no second
provider cancellation.
- Reject foreign company, run, issue, scope, effect, and missing-audit
receipts before any write.
- Check that an acknowledged Stop with an unconfirmed remote lease still
fails the physical-stop guard.
- Document the separate retry fence and physical-cleanup requirements.

## Verification

- RED on the selected public base: the new executor case returned
success but left the coordinator in `retryable_failure` with a future
retry. One case executed and failed for that assertion.
- GREEN: 62 focused tests passed across
`native-session-executor.test.ts` and
`native-cancellation-request.test.ts`. These include ownership, caller
conflict, changed-phase, and receipt controls.
- Command from `server/`: `node ../node_modules/vitest/vitest.mjs run
src/services/native-runtime/native-session-executor.test.ts
src/services/native-runtime/native-cancellation-request.test.ts -t
'native session cancellation|caller-bound native cancellation|failed
native retry caller admission'`.
- Canonical Linux CI passed all 1,018 executor cases and all 32
caller-cancellation cases. The exact file completion lines are in
[server shard
2](https://github.com/paperclipai/paperclip/actions/runs/41203989386/job/124545366271)
and [server shard
10](https://github.com/paperclipai/paperclip/actions/runs/41203989386/job/124545366219).
- Node 24.22.2 and Vitest 5.0.3. Map contract checks and `git diff
--check` pass.
- Local dependencies are linked from an existing checkout. Full local
TypeScript validation reports older Runner/shared declarations that lack
current Kimi and continuity APIs. The changed ranges have no
diagnostics. The canonical clean CI Typecheck + Release Registry gate
passed.
- A broader two-file run was stopped when an unchanged integration case
tried to start embedded Postgres and hit the host listen restriction. It
is not a passing full-suite result. No host settings or other services
were changed.
- Repository-wide `pnpm -r typecheck`, `pnpm test:run`, and `pnpm build`
were not completed locally. Current-head CI passed against clean source
and dependencies.
- Fresh [Greptile
review](https://github.com/paperclipai/paperclip/pull/18457#issuecomment-6543772487)
on `dbc1c1a5b71450194d568725592969660864cb5a`: 5/5 with no actionable
findings. The review-thread inventory has no threads and no pagination.
Full [current-head
CI](https://github.com/paperclipai/paperclip/actions/runs/41203989386)
passed: 59 terminal checks, 55 successful, 3 skipped, and 1 neutral. No
failure or pending check remains. Merge status is CLEAN. No live
recovery, rollout, or physical termination is claimed.

## Risks

- A wrong or stale Stop must not close another retry. Existing
run/coordinator locks, caller checks, receipt binding, and the final
compare-and-set remain in place.
- This fix changes logical retry settlement only. Provider termination,
workspace preservation, lease cleanup, and continuation gates remain
separate.
- The regression controls persistence and provider boundaries. It does
not establish the physical state of a remote provider.

## Model Used

- OpenAI GPT-6 through Codex, with reasoning, code editing, and tool
use. The session does not expose an exact model build ID or
context-window capacity.

## 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 references)
- [x] My branch name describes the change 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-10-31 08:25:16 -05:00
DottaandPaperclip 0b4e48be9b Merge current controller recovery with scoped issue deadlines
Preserve keyed concurrent checks and their default serial behavior alongside issue-recovery reconstruction spacing and before-pass preparation. Qualify keyed ordering, joined preparation, exact deadline preemption and retained late-write reconstruction debt across drain.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 08:20:41 -05:00
DottaandPaperclip ab51cabbbd test: await async outcomes and drive saved deadlines deterministically (#18416)
Reviewed and verified at ab0b15d234.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 08:18:15 -05:00
DottaandPaperclip d1f9534c54 Merge current master qualification into event-driven run dispatch
Preserve retained-controller recovery deadlines and rearming together with company-scoped dispatch forwarding. Keep both source owners and all incoming master changes; no execution or retry policy changes.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-31 08:03:05 -05:00