paperclip/packages/db/src/schema
Devin Foley 1f70fd9a22
PAPA-430: workspace finalize gates + no-remote-git enforcement (#6969)
## Thinking Path

> - Paperclip orchestrates AI agents across isolated execution
workspaces; the local cwd is the only persistence boundary between runs.
> - Workspace lifecycle (worktree_prepare → execute →
workspace_finalize) and the wake/accept flow are what guarantee that
dependent issues see a consistent worktree.
> - PAPA-380 / PAPA-431 / PAPA-432 / PAPA-440 surfaced three holes in
that contract: silent env reuse across assignees, dependent wakes firing
before finalize, and `issue.interaction.accept` advancing before
finalize landed.
> - PAPA-441 / PAPA-442 then needed to document the "no remote git"
contract and prevent future adapter/runtime code from quietly
reintroducing `git push` as a backdoor sync.
> - This pull request lands those server fixes, the static
`check-no-git-push` enforcement, the AUTHORING.md cross-link, and the
Cody-review follow-ups on the PAPA-430 thread.
> - The benefit is that finalize is a real barrier — board accepts,
dependent wakes, and operator-set env all respect it — and adapter code
can't bypass it via raw `git push`.

## What Changed

- **server (PAPA-380, PAPA-431):** `execution-workspace-policy` refuses
silent env reuse when the assignee's resolved env disagrees with the
workspace it would inherit. The inheritance protection is now scoped to
the actual inheritance signal — explicit issue-level `environmentId` is
honored even when the agent's default env is `null`.
- **server (PAPA-432):** `heartbeat.ts` gates dependent wakes on
`listUnfinalizedExecutionWorkspaceIds`, and writes a
`workspace_finalize` row on the succeeded path. Write failures now
surface instead of being swallowed so dependents aren't silently
stranded behind a missing row.
- **server (PAPA-440):** `issue-thread-interactions.acceptInteraction`
adds a workspace_finalize precondition for `request_confirmation` (not
`suggest_tasks`). Accept returns 409 if finalize hasn't succeeded for
the latest workspace operation.
- **ci (PAPA-442):** new `scripts/check-no-git-push.mjs` static check
scans `packages/adapters/`, `packages/adapter-utils/`, `server/src/`,
and `cli/src/` for any `git push` invocation (string or args-array).
Wired into the `policy` PR job and `test:release-registry`. Operators
can opt in per-call with `// paperclip:allow-git-push: <reason>`.
Release scripts are out of scope by design.
- **docs (PAPA-441):** `AUTHORING.md` documents the no-remote-git
contract and cross-links the static check so adapter authors learn the
rule and the enforcement together.
- **review follow-up (PAPA-430, Cody):** three fixes — env resolver bug,
accept-gate scope (request_confirmation only), and finalize record write
on the succeeded path.

## Verification

- `pnpm exec vitest run
server/src/__tests__/execution-workspace-policy.test.ts
server/src/__tests__/issue-thread-interactions-service.test.ts` → 33/33
pass
- `node scripts/check-no-git-push.test.mjs` → check covers string form,
args-array form, comment exclusions, and per-line allow-comment.
- Manual: server compiles; the policy job runs the check in <1s before
heavier jobs.

## Risks

- **Behavioral shift in accept:** boards accepting
`request_confirmation` while finalize is in-flight now get 409s. This is
intentional — they can retry — but it changes timing on a hot path.
`suggest_tasks` is unaffected.
- **Workspace policy:** the env-reuse refusal is a new error path.
Issues that previously silently reused an env from a different-assignee
workspace will now fail-loud; the resolver still honors explicit
issue-level `executionWorkspaceSettings.environmentId`.
- **CI rule:** any future legitimate `git push` in scoped dirs must be
marked with the allow-comment, which is the intended ergonomic.

## Model Used

- Claude Opus 4.7 (`claude-opus-4-7`, extended thinking), via Claude
Code in the Paperclip executor adapter.

## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots (N/A — server/CI/docs only)
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge

Closes related issues: PAPA-430, PAPA-380, PAPA-431, PAPA-432, PAPA-440,
PAPA-441, PAPA-442

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-05-29 08:25:29 -07:00
..
activity_log.ts Add issue identifiers, activity run tracking, and migration inspection 2026-02-19 09:09:26 -06:00
agent_api_keys.ts Expand data model with companies, approvals, costs, and heartbeats 2026-02-17 09:07:22 -06:00
agent_config_revisions.ts Add agent config revisions, issue-approval links, and robust migration reconciliation 2026-02-19 13:02:14 -06:00
agent_memberships.ts [codex] Add resource membership controls (#6677) 2026-05-25 13:12:41 -05:00
agent_runtime_state.ts Add agent runtime DB schemas and expand shared types 2026-02-17 12:24:38 -06:00
agent_task_sessions.ts Add agent task sessions table, session types, and programmatic DB backup 2026-02-19 14:01:40 -06:00
agent_wakeup_requests.ts Add agent runtime DB schemas and expand shared types 2026-02-17 12:24:38 -06:00
agents.ts Add SSH environment support (#4358) 2026-04-23 19:15:22 -07:00
approval_comments.ts Scaffold agent permissions, approval comments, and hiring governance types 2026-02-19 09:10:48 -06:00
approvals.ts Expand data model with companies, approvals, costs, and heartbeats 2026-02-17 09:07:22 -06:00
assets.ts feat: add storage system with local disk and S3 providers 2026-02-20 10:31:56 -06:00
auth.ts feat: add auth/access foundation - deps, DB schema, shared types, and config 2026-02-23 14:40:16 -06:00
board_api_keys.ts Address Greptile review on board CLI auth 2026-03-23 08:46:05 -05:00
budget_incidents.ts Fix budget incident resolution edge cases 2026-03-16 16:48:13 -05:00
budget_policies.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
cli_auth_challenges.ts Add browser-based board CLI auth flow 2026-03-23 08:46:05 -05:00
cloud_upstreams.ts [codex] Add local Cloud Upstream sync (#6548) 2026-05-22 09:56:22 -05:00
companies.ts [codex] Split backend control-plane QoL slice (#4700) 2026-04-28 16:46:45 -05:00
company_logos.ts Use asset-backed company logos 2026-03-16 09:25:39 -05:00
company_memberships.ts feat: add auth/access foundation - deps, DB schema, shared types, and config 2026-02-23 14:40:16 -06:00
company_secret_bindings.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
company_secret_provider_configs.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
company_secret_versions.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
company_secrets.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
company_skills.ts Namespace company skill identities 2026-03-16 18:27:20 -05:00
company_user_sidebar_preferences.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00
cost_events.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
document_annotation_anchor_snapshots.ts [codex] Add document annotations and comments (#6733) 2026-05-26 06:41:23 -07:00
document_annotation_comments.ts [codex] Add document annotations and comments (#6733) 2026-05-26 06:41:23 -07:00
document_annotation_threads.ts [codex] Add document annotations and comments (#6733) 2026-05-26 06:41:23 -07:00
document_revisions.ts Add feedback voting and thumbs capture flow 2026-04-02 09:11:49 -05:00
documents.ts [codex] Add issue document locking (#6009) 2026-05-15 08:54:55 -05:00
environment_leases.ts Add local environment lifecycle (#4297) 2026-04-22 20:07:41 -07:00
environments.ts Add SSH environment support (#4358) 2026-04-23 19:15:22 -07:00
execution_workspaces.ts PAPA-430: workspace finalize gates + no-remote-git enforcement (#6969) 2026-05-29 08:25:29 -07:00
feedback_exports.ts Add feedback voting and thumbs capture flow 2026-04-02 09:11:49 -05:00
feedback_votes.ts Add feedback voting and thumbs capture flow 2026-04-02 09:11:49 -05:00
finance_events.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
goals.ts Expand data model with companies, approvals, costs, and heartbeats 2026-02-17 09:07:22 -06:00
heartbeat_run_events.ts Add agent runtime DB schemas and expand shared types 2026-02-17 12:24:38 -06:00
heartbeat_run_watchdog_decisions.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
heartbeat_runs.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
inbox_dismissals.ts Persist non-issue inbox dismissals 2026-04-09 06:16:05 -05:00
index.ts Add accepted-plan decomposition exact-once guards and UI state (#6831) 2026-05-28 23:30:18 -07:00
instance_settings.ts Add username log censor setting 2026-03-20 08:50:00 -05:00
instance_user_roles.ts feat: add auth/access foundation - deps, DB schema, shared types, and config 2026-02-23 14:40:16 -06:00
invites.ts feat: add auth/access foundation - deps, DB schema, shared types, and config 2026-02-23 14:40:16 -06:00
issue_approvals.ts Add agent config revisions, issue-approval links, and robust migration reconciliation 2026-02-19 13:02:14 -06:00
issue_attachments.ts feat: add storage system with local disk and S3 providers 2026-02-20 10:31:56 -06:00
issue_comments.ts Add recovery handoff system notices (#5289) 2026-05-06 06:05:58 -05:00
issue_documents.ts feat(issues): add issue documents and inline editing 2026-03-13 21:30:48 -05:00
issue_execution_decisions.ts Add issue review policy and comment retry 2026-04-07 17:43:10 -05:00
issue_inbox_archives.ts Add the inbox mine tab and archive flow 2026-03-26 16:09:43 -05:00
issue_labels.ts feat: add issue labels (DB schema, API, and service) 2026-02-25 08:38:37 -06:00
issue_plan_decompositions.ts Add accepted-plan decomposition exact-once guards and UI state (#6831) 2026-05-28 23:30:18 -07:00
issue_read_states.ts Persist issue read state and clear unread on open 2026-03-06 08:34:19 -06:00
issue_recovery_actions.ts [codex] Add source-scoped recovery actions (#5599) 2026-05-12 09:37:15 -05:00
issue_reference_mentions.ts Add first-class issue references (#4214) 2026-04-21 10:02:52 -05:00
issue_relations.ts fix: address greptile feedback for blocker dependencies 2026-04-06 09:03:13 -05:00
issue_thread_interactions.ts [codex] Add structured issue-thread interactions (#4244) 2026-04-21 20:15:11 -05:00
issue_tree_hold_members.ts [codex] Add issue subtree pause, cancel, and restore controls (#4332) 2026-04-23 14:51:46 -05:00
issue_tree_holds.ts [codex] Add issue subtree pause, cancel, and restore controls (#4332) 2026-04-23 14:51:46 -05:00
issue_work_products.ts Implement execution workspaces and work products 2026-03-13 17:12:25 -05:00
issues.ts Add planning mode for issue work (#5353) 2026-05-06 07:01:28 -05:00
join_requests.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
labels.ts feat: add issue labels (DB schema, API, and service) 2026-02-25 08:38:37 -06:00
plugin_company_settings.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin_config.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin_database.ts [codex] Add plugin orchestration host APIs (#4114) 2026-04-20 08:52:51 -05:00
plugin_entities.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin_jobs.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin_logs.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin_managed_resources.ts Expand plugin host surface (#5205) 2026-05-05 07:42:57 -05:00
plugin_state.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin_webhooks.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugins.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
principal_permission_grants.ts feat: add auth/access foundation - deps, DB schema, shared types, and config 2026-02-23 14:40:16 -06:00
project_goals.ts feat: add project_goals many-to-many join table 2026-02-20 13:43:25 -06:00
project_memberships.ts [codex] Add resource membership controls (#6677) 2026-05-25 13:12:41 -05:00
project_workspaces.ts Implement execution workspaces and work products 2026-03-13 17:12:25 -05:00
projects.ts Add project-level environment variables 2026-04-06 21:23:30 -05:00
routines.ts [codex] Add routine env secrets support (#6212) 2026-05-17 16:30:34 -05:00
secret_access_events.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
user_sidebar_preferences.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00
workspace_operations.ts PAPA-430: workspace finalize gates + no-remote-git enforcement (#6969) 2026-05-29 08:25:29 -07:00
workspace_runtime_services.ts Implement execution workspaces and work products 2026-03-13 17:12:25 -05:00