Files
PaperClipAI/maps/agent-access-map
DottaandPaperclip b4315943e8 fix(heartbeat): keep remote retry workspace strategy stable (#18660)
## Thinking Path

> - Paperclip preserves agent work across separate execution services.
> - A remote retry can create a new isolated Git workspace.
> - Later admissions compare its saved configuration with the current
policy.
> - Fresh preparation also creates a temporary controller-side strategy.
> - Remote preparation saved that temporary strategy in its fingerprint.
> - The next unchanged turn then reported a workspace strategy
replacement.
> - This change saves the admitted remote strategy so unchanged reuse
stays stable.

## Linked Issues or Issue Description

Related preparation work: #18543 and #17924. I searched open and merged
workspace/session repairs and public workspace-strategy issues. None
covers this fresh remote retry case.

**What happened?**

After Retry created an isolated remote Git workspace, each unchanged
follow-up reported `workspace_config_freshness` with `action: replace`
and `changedCategories: [strategy]`. It retained the same workspace. The
stored fingerprint contained `project_primary`, which was only a
temporary controller provisioning choice.

**Expected behavior**

Save the configured remote strategy. An unchanged follow-up must reuse
the same workspace without a false replacement report. A real strategy,
base-ref, mode or environment change must retain its replacement checks.

**Steps to reproduce**

1. Prepare a fresh isolated remote Git retry with a `git_worktree`
strategy.
2. Complete its runtime handoff.
3. Admit another turn with the same workspace policy.
4. Inspect the recorded workspace freshness decision.

**Paperclip version or commit**

Reproduced on `b9e94b85a69bf679818eeef9ecf4655554a89c6b`. The regression
also fails on the unchanged preparation code in the current base.

**Deployment mode**

Authenticated server with remote workspace authority and a sandbox
execution target.

## What Changed

- Keep the admitted strategy when a fresh workspace uses remote
authority.
- Retain the temporary controller strategy for existing host-side seed
preparation.
- Extend the PostgreSQL preparation test through a fresh admission and
its next ordinary admission. Assert the same workspace, current writer
and stable fingerprint, with no false drift operation.
- Cover a genuinely configured `project_primary` fresh remote Git retry
followed by a real strategy change, preserving its replacement decision
and stored fingerprint.
- Document the execution rule and the separate live verification recipe.

## Verification

- The final regression was run before and after the production change.
Before: the next admission recorded a strategy replacement. After:
unchanged reuse records no drift and retains the workspace and
fingerprint.
- All 312 targeted cases pass on
`48b3e548afa42e740871feae2763d88fd5a00431` across workspace preparation,
workspace/session policy and inherited session preparation. These
include actual strategy/base-ref changes and the rule that explicit
reuse must not hide real replacement-class drift.
- All eight remote preparation cases also pass with the compatibility
regression: a genuinely configured `project_primary` fresh Git retry
creates a `git_worktree` row, and its later real strategy change retains
the replacement decision and saved fingerprint.
- `node scripts/check-maps.mjs` and `git diff --check` pass.
- Full recursive typecheck and `pnpm build` pass locally on this head.
- The [full current-head CI
matrix](https://github.com/paperclipai/paperclip/actions/runs/41524105868)
passes: typecheck/build, all general server, chat, workspace and
serialized test groups, plus Runner and E2E checks. The workflow and
`run-vitest-stable.mjs` partition the complete suite.
- The duplicate local `pnpm test:run` passed all 1,828 chat cases and
was intentionally stopped during general-server after the same complete
CI matrix passed. This is not recorded as a full local-suite pass.
- Greptile and Paperclip Review both assessed this head at 5/5 with no
new findings. Paperclip Review accepted the compatibility boundary after
the counterexample; its check conclusion is neutral. The addressed
review thread is resolved.
- The regression uses real PostgreSQL and preparation policy. Runtime
acquisition is controlled at its external boundary. The new fix has not
been deployed; live provider resumption remains unverified for this
patch.

## Risks

- Existing incorrect fingerprints are not rewritten. The same stored
shape can come from a genuinely configured `project_primary` remote Git
retry; a Git workspace row alone cannot prove the old admission policy.
Rewriting it would hide a real policy change. After preserving and
inspecting retained work, an explicitly admitted fresh recovery after
rollout establishes a correct new fingerprint. Ordinary reuse of the old
workspace does not migrate it. Normal recovery gates remain required.
- Real policy changes still use the current replacement guard. No
schema, credential or authority change is included.

## Model Used

OpenAI GPT-6 Codex with reasoning, repository editing, shell execution,
PostgreSQL tests and browser inspection. The host does not expose the
exact model variant 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
- [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-02 16:11:30 -06:00
..

Paperclip agent access map

This map accompanies the feature map. It records APIs, agent entry points, permission boundaries and verification for the same capability IDs. The shared contract defines the format and maintenance rules.

The chat scenario catalog uses these same IDs for human requests and expected outcomes. Its scenarios retain the access boundaries here; neither a CEO role nor a planned scenario grants board authority or establishes a working production tool binding.

Use full capability IDs when referring to access contracts outside their file: onboarding/company means the company capability in onboarding.md in both maps. The feature index lists feature and capability IDs; IDs and references explains entry-point references and stable naming.

Browse access contracts

The same-named feature recipes define navigation and capability IDs. Run node scripts/storybook-catalog.mjs for the generated maps/generated/agent-access-map.md index, or browse the published feature guide. Add or update the affected companion; there is no central registration or count.

Existing baseline source references describe the original inspection, not current verification. Record new executed evidence in the PR, issue, or CI artifact with its revision and scope. Do not refresh unrelated headers as bookkeeping.

Using an entry

Read its Policy and Gaps before selecting an agent path. Native fallback, legacy REST/CLI, stdio MCP and a personal assistant connection can have different authority and availability. Use a real admitted production binding; a scenario declaration is not an installed tool. A restricted entry records current enforcement and leaves any unresolved delegation decision visible.

For API catalog disagreements, follow the route/service authorization and record discovery drift. For not-applicable, retain the concrete exception and local path. Split shared business operations from client-only presentation.

Use maintain-verification-skill to reconcile changed source and both maps. Use verify-paperclip and existing API/runner/MCP fixtures to collect the permitted-agent and denial evidence; report blocked/not-run coverage honestly. Run node scripts/check-maps.mjs after editing. The structural check does not certify permissions, API catalog coverage, tool admission or live behavior.

Native REST transport

The call_api parity change reconciles affected baselines against 58e16dbddfc9c8d0cf60867f9d9847f0feda055b and the changes in this PR. Ordinary REST operations use the same route authorization as legacy agent REST. Dedicated tools remain optional for those operations; protocol endpoints still need their existing clients. Board-only routes remain restricted for agent identity.

Native search_api / call_api is enabled by default, but explicit server, company-allowlist and binding settings can narrow admission. It requires a running authorized native run, current task assignment and execution-run binding, company and budget authority, task privacy, and a permitted work mode. Ask and Plan retain mutation restrictions, and runs retain their admitted JWT scope during restart recovery even when task mode changes. A waiting agent does not gain independent native control just because a REST route exists. Connection-management reads support Standard, Ask and Plan; mutations require Standard. Skill-test runs and nonstandard task-bridge keys cannot administer connections. These gates supplement each operation's grants, resolved resource and target scope, and responsible-user authority. See the rollout policy and connection authorization.

Credential-bearing replies, including company exports and their legacy alias, stay inline under a 10 MiB limit and use encrypted mutation receipts. Other saved API snapshots are limited to the issuing actor and responsible user, plus authorized administrators. Artifact uploads enforce the same access checks as downloads; private snapshots are excluded from company exports and public company logos. Explicit deliverables use the existing sharing path. Native event history, checkpoints and completion records omit API bodies while preserving receipt metadata and replay digests. Restored webhook secrets use the same encrypted receipt and inline response policy as newly created webhook secrets. Task image access requires the company boundary and the task permission; skill-test and low-trust agents do not need company-wide browsing authority. Completion replay applies the same idempotent projection to stored and expected payloads; the run-log guide describes its fields.

Sources: API client, catalog, native authority, credential storage classification, snapshot access, and history redaction. The affected entries remain baseline and source-only; this reconciliation does not certify every operation. Targeted real-route proof lives in the API integration suite, including owned routines, skill tests, scoped secrets, proposals and private export replay.