paperclip/server/src/services
Nicky Leach 295294d7ce
Add read-only issue blocker diagnostics endpoint (#9114)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents block each other with `blockedByIssueIds` relationships to
express dependencies
> - Users and tooling have no lightweight way to inspect *why* an issue
is blocked or whether its blockers are themselves ready to resolve
> - A read-only diagnostic endpoint over the existing blocker graph lets
callers understand dependency chains without requiring a full issue-tree
traversal
> - This pull request adds `GET /api/issues/:id/diagnostics/blockers` —
a bounded, read-only projection over each blocker's readiness state
> - The benefit is that callers can surface blocking-chain diagnosis
(e.g. "waiting on N blockers, M of which are themselves blocked") from a
single authenticated request, using only data they already have read
permission for

## Linked Issues or Issue Description

No public GitHub issue exists for this change. Feature description:

**Subsystem affected:** `server/` — REST API & orchestration services;
`packages/shared` — types, constants, validators, API paths

**Problem or motivation**

There is no API endpoint to inspect *why* an issue is blocked or to get
a per-blocker readiness summary. Clients must walk the issue graph
manually or fetch full issue objects, which requires multiple
round-trips and is expensive.

**Proposed solution**

A single `GET /api/issues/:id/diagnostics/blockers` endpoint returns a
bounded projection: root issue summary, an ordered blocker list with
per-blocker `readiness` state, and a top-level `diagnosis` field
summarizing overall blocking status. Authorization mediation omits
blockers the caller cannot read, so `diagnosis` only reflects visible
data.

**Alternatives considered**

A general graph-walk query (too broad/expensive for a targeted
diagnostic call); enriching the existing `GET /api/issues/:id` response
(too coupled to the main response shape and adds weight for callers that
do not need blocker detail).

**Roadmap alignment**

Read-only observability surface over existing data; no database schema
changes. This aligns with tooling that helps users understand dependency
state without mutating anything.

## What Changed

- Added `GET /api/issues/:id/diagnostics/blockers` route to the server
- Returns per-blocker `readiness` state and a top-level `diagnosis`
field summarizing overall blocking status
- Enforces `issue:read` authorization per-blocker: unauthorized blockers
are omitted and do not influence `diagnosis` or `readiness` values
- Added shared TypeScript response types in `@paperclipai/shared`
- Added route-level tests using embedded Postgres
- Added API documentation in the `paperclip` skill

## Verification

```sh
./node_modules/.bin/vitest run server/src/__tests__/issue-blocker-diagnostics-routes.test.ts
pnpm --filter @paperclipai/shared typecheck
pnpm --filter @paperclipai/server typecheck
```

All three commands pass locally.

## Risks

- Read-only endpoint over existing relations — no writes, no schema or
migration changes — low risk
- Authorization mediation intentionally omits unauthorized blockers from
both the list and from `diagnosis`/`readiness`; callers with partial
access will see a narrower picture than the full blocker graph

## Model Used

- Provider: Anthropic
- Model: Claude Sonnet 4.6 (`claude-sonnet-4-6`)
- Context window: 200k tokens
- Mode: Tool use, code generation, extended reasoning

## 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-07-06 20:42:40 -07:00
..
recovery Add dependency wake reconciliation backstop (#8943) 2026-07-03 18:30:51 -07:00
access.ts [codex] prevent invalid agents from receiving assignments and runs (#7663) 2026-06-06 12:45:57 -05:00
activity-log.ts [codex] Add plugin orchestration host APIs (#4114) 2026-04-20 08:52:51 -05:00
activity.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
adapter-models-env.test.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
adapter-models-env.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
adapter-plugin-store.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
adapter-registry-bootstrap.reconcile.test.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
adapter-registry-bootstrap.test.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
adapter-registry-bootstrap.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
agent-assignability.ts [codex] prevent invalid agents from receiving assignments and runs (#7663) 2026-06-06 12:45:57 -05:00
agent-instructions.ts chore: mark bootstrapPromptTemplate as deprecated 2026-03-26 11:12:25 -05:00
agent-invokability.ts fix(runtime): keep agent pause durable at execution-start (#8317) 2026-06-19 08:35:53 -07:00
agent-permissions.ts [codex] Gate skill mutations with skills:create permission (#8616) 2026-06-25 09:49:10 -05:00
agent-secret-bindings.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
agent-start-lock.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
agents.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
approvals.ts fix(agents): clear inbox hire approval when approving/terminating from detail page (#8340) 2026-06-19 12:15:57 -07:00
assets.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
authorization.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
board-auth.ts Improve CLI API parity coverage (#6626) 2026-06-02 17:13:29 -07:00
budgets.ts [codex] Enforce backend execution release gates (#9089) 2026-07-06 16:33:36 -05:00
catalog-provenance.ts [codex] Add skills CLI and catalog management (#6782) 2026-05-28 07:33:51 -10:00
cloud-upstreams.ts [codex] Bundle local branch fixes from PAP-10032 (#6604) 2026-05-25 07:25:26 -05:00
codex-auth-reconciliation.ts fix(codex-local): seed managed auth into isolated homes (#8403) 2026-06-20 16:17:54 -07:00
companies.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
company-artifacts.ts PAP-10440: group artifacts by task stacks (#7654) 2026-06-06 10:22:47 -05:00
company-export-readme.ts fix: link Agent Company to agentcompanies.io in export README 2026-03-20 08:06:04 -05:00
company-member-roles.ts [codex] Gate skill mutations with skills:create permission (#8616) 2026-06-25 09:49:10 -05:00
company-portability.ts [codex] Add built-in Hermes adapters (#8543) 2026-06-26 16:04:58 -05:00
company-search-rate-limit.ts Add full company search page (#5293) 2026-05-06 06:32:37 -05:00
company-search.ts Add company artifacts page (#7621) 2026-06-05 18:11:05 -05:00
company-skills.ts [codex] Fix local skill, secrets, and file viewer regressions (#8586) 2026-06-24 09:17:51 -05:00
costs.ts Improve operator workflow QoL (#5291) 2026-05-06 06:30:44 -05:00
cron.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
dashboard.ts [codex] Harden heartbeat scheduling and runtime controls (#4223) 2026-04-21 12:24:11 -05:00
default-agent-instructions.ts Add default agent instructions bundle 2026-03-20 07:42:36 -05:00
document-annotations.ts feat(control-plane): add annotation and workspace controls (#8229) 2026-06-23 12:00:03 -05:00
documents.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
effective-run-config-fingerprints.ts Refresh run config before reusing workspaces (#8797) 2026-06-30 14:50:25 -07:00
environment-config.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
environment-custom-image-runtime.ts Scope environment custom images to instance environments (#8850) 2026-07-01 23:57:31 -07:00
environment-custom-image-setup-session-utils.ts Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
environment-custom-image-terminal-sessions.test.ts Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
environment-custom-image-terminal-sessions.ts Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
environment-custom-images.ts Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
environment-execution-target.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
environment-probe.ts Scope environment custom images to instance environments (#8850) 2026-07-01 23:57:31 -07:00
environment-run-orchestrator.ts refactor(environments): make execution environments instance-scoped (#8375) 2026-06-20 09:42:53 -07:00
environment-runtime.ts Refresh run config before reusing workspaces (#8797) 2026-06-30 14:50:25 -07:00
environments.ts feat: reuse Daytona sandbox leases (#8513) 2026-06-22 19:35:53 -07:00
execution-allowlist.test.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
execution-allowlist.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
execution-policy-bootstrap.test.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
execution-policy-bootstrap.ts feat(server): kubernetes execution integration for sandbox-provider plugins (stage 2/3) (#7938) 2026-06-10 21:09:02 -07:00
execution-workspace-policy.ts refactor(environments): make execution environments instance-scoped (#8375) 2026-06-20 09:42:53 -07:00
execution-workspaces.ts [codex] Add bounded workspace overview (#8627) 2026-06-25 21:38:14 -05:00
external-objects.ts External object references across issue surfaces (#8512) 2026-06-23 08:27:19 -05:00
feedback-redaction.ts Add feedback voting and thumbs capture flow 2026-04-02 09:11:49 -05:00
feedback-share-client.ts Restore feedback trace export fixes 2026-04-03 15:59:42 -05:00
feedback.ts Redact deleted issue comments 2026-06-05 03:20:46 +00:00
finance.ts Sync/master post pap1497 followups 2026 04 15 (#3779) 2026-04-15 21:13:56 -05:00
github-external-object-provider.ts External object references across issue surfaces (#8512) 2026-06-23 08:27:19 -05:00
github-fetch.ts fix: harden GHE URL detection and extract shared GitHub helpers 2026-04-01 21:05:48 +00:00
goals.ts Improve onboarding defaults and issue goal fallback 2026-03-12 08:50:31 -05:00
heartbeat-run-runtime-status.test.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
heartbeat-run-runtime-status.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
heartbeat-run-summary.ts [codex] Add run liveness continuations (#4083) 2026-04-20 06:01:49 -05:00
heartbeat-stop-metadata.test.ts [codex] Retry max-turn exhausted heartbeats (#5096) 2026-05-03 11:30:48 -05:00
heartbeat-stop-metadata.ts [codex] Retry max-turn exhausted heartbeats (#5096) 2026-05-03 11:30:48 -05:00
heartbeat.ts Fail projectless git-worktree workspaces during heartbeat setup (#9118) 2026-07-06 16:48:05 -07:00
hire-hook.ts fix(adapters): honor paused overrides and isolate UI parser state 2026-04-04 14:04:33 -05:00
inbox-dismissals.ts Persist non-issue inbox dismissals 2026-04-09 06:16:05 -05:00
index.ts Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
instance-settings.ts Add workspace branch ancestry diagnostics (#9117) 2026-07-06 16:29:01 -07:00
invite-grants.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
issue-approvals.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
issue-assignment-wakeup.ts fix: close remaining routine merge blockers 2026-03-20 16:40:27 -05:00
issue-continuation-summary.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
issue-dependency-wakeups.ts Add dependency wake reconciliation backstop (#8943) 2026-07-03 18:30:51 -07:00
issue-execution-policy.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
issue-goal-fallback.ts Seed onboarding project and issue goal context 2026-03-24 11:48:59 -05:00
issue-liveness.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
issue-recovery-actions.ts [codex] Add source-scoped recovery actions (#5599) 2026-05-12 09:37:15 -05:00
issue-references.ts Redact deleted issue comments 2026-06-05 03:20:46 +00:00
issue-thread-interactions.test.ts [codex] Add structured issue-thread interactions (#4244) 2026-04-21 20:15:11 -05:00
issue-thread-interactions.ts Emit interaction resolved telemetry (#8824) 2026-07-01 13:43:11 -07:00
issue-tree-control.ts [codex] Split backend control-plane QoL slice (#4700) 2026-04-28 16:46:45 -05:00
issues.ts Add read-only issue blocker diagnostics endpoint (#9114) 2026-07-06 20:42:40 -07:00
json-schema-secret-refs.ts Generalize sandbox provider core for plugin-only providers (#4449) 2026-04-24 18:03:41 -07:00
live-events.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
local-service-supervisor.ts Add workspace file viewer and artifact links (#7681) 2026-06-09 17:17:43 -05:00
low-trust-runtime-containment.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
pipeline-case-outputs.ts Add pipeline workflow primitives and operator UI (#7903) 2026-06-26 12:02:44 -05:00
pipeline-conversation-context.ts Add pipeline workflow primitives and operator UI (#7903) 2026-06-26 12:02:44 -05:00
pipelines-aggregation.ts Add pipeline workflow primitives and operator UI (#7903) 2026-06-26 12:02:44 -05:00
pipelines.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
plan-review-context.ts [codex] Preserve plan review context in agent wakes (#8649) 2026-06-29 13:26:26 -05:00
plugin-capability-validator.ts Add reusable sandbox custom images (#8794) 2026-06-30 09:57:49 -07:00
plugin-config-validator.ts Refactor secret-ref format registration to use a UI hint for Paperclip secret UUIDs 2026-03-14 15:43:56 -07:00
plugin-database.ts Fix LLM Wiki package and migration validation (#6010) 2026-05-15 10:20:02 -05:00
plugin-dev-watcher.ts [codex] Improve local plugin development workflow (#5821) 2026-05-12 17:38:24 -05:00
plugin-environment-driver.ts Add reusable sandbox custom images (#8794) 2026-06-30 09:57:49 -07:00
plugin-event-bus.ts Simplify plugin runtime and cleanup lifecycle 2026-03-13 16:58:29 -05:00
plugin-host-service-cleanup.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-host-services.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
plugin-job-coordinator.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-job-scheduler.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-job-store.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-lifecycle.ts [codex] Runtime control-plane fixes (#6380) 2026-05-20 10:37:11 -05:00
plugin-loader.ts Auto-build bundled plugins on install (#8254) 2026-06-17 22:39:55 -07:00
plugin-local-folders.ts [codex] Roll up May 17 branch changes (#6210) 2026-05-17 17:15:06 -05:00
plugin-log-retention.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-managed-agents.ts [codex] Add LLM Wiki plugin host support (#5597) 2026-05-10 07:34:12 -05:00
plugin-managed-routines.ts Expand plugin host surface (#5205) 2026-05-05 07:42:57 -05:00
plugin-managed-skills.ts [codex] Add LLM Wiki plugin host support (#5597) 2026-05-10 07:34:12 -05:00
plugin-manifest-validator.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-registry.ts feat(security): plugin tables get company_id FK for tenant isolation (#5865) 2026-06-12 10:17:19 -07:00
plugin-runtime-sandbox.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-secrets-handler.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
plugin-state-store.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-stream-bus.ts Add plugin framework and settings UI 2026-03-13 16:22:34 -05:00
plugin-tool-dispatcher.ts fix(plugin-tool-dispatcher): propagate pluginDbId so worker.isRunning resolves (#5671) 2026-06-03 19:13:21 -07:00
plugin-tool-registry.ts fix(plugin-tool-dispatcher): propagate pluginDbId so worker.isRunning resolves (#5671) 2026-06-03 19:13:21 -07:00
plugin-worker-manager.ts [codex] Bundle local branch fixes from PAP-10032 (#6604) 2026-05-25 07:25:26 -05:00
portable-path.ts [codex] Add skills CLI and catalog management (#6782) 2026-05-28 07:33:51 -10:00
principal-access-compatibility.ts [codex] Add agent permissions and controls plan (#6386) 2026-05-22 08:12:52 -05:00
productivity-review.ts Guard cheap recovery model usage (#6371) 2026-05-19 13:46:02 -05:00
project-workspace-runtime-config.ts [codex] Respect manual workspace runtime controls (#4125) 2026-04-20 10:39:37 -05:00
projects.ts Information Architecture + project/agent visual refresh (experimental) (#7543) 2026-06-06 09:17:27 -05:00
quota-windows.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
resource-memberships.ts [codex] Add starred resource sidebar controls (#9085) 2026-07-06 14:09:11 -05:00
responsible-user-denial-run-outcomes.test.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
responsible-user-denial-run-outcomes.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
routines-formatter-cache.test.ts fix(server): cache Intl.DateTimeFormat per timezone in cron minute-stepper (#8033) (#8034) 2026-06-12 10:15:53 -07:00
routines.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
run-continuations.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
run-liveness.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
run-log-store.ts [codex] Add runtime lifecycle recovery and live issue visibility (#4419) 2026-04-24 15:50:32 -05:00
runtime-skill-selections.ts Build the Skills Store (#7990) 2026-06-11 14:02:09 -05:00
sandbox-provider-runtime.ts feat: reuse Daytona sandbox leases (#8513) 2026-06-22 19:35:53 -07:00
secrets.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
session-workspace-cwd.test.ts fix(remote-sandbox): harden host workspace resumes (#5922) 2026-05-13 16:23:04 -05:00
session-workspace-cwd.ts fix(remote-sandbox): harden host workspace resumes (#5922) 2026-05-13 16:23:04 -05:00
sidebar-badges.ts Persist non-issue inbox dismissals 2026-04-09 06:16:05 -05:00
sidebar-preferences.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00
skills-catalog.ts fix(server): resolve published skills catalog package root and fallback (#8327) 2026-06-19 09:14:41 -07:00
source-trust.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
task-watchdog-scope.ts [codex] feat(watchdog): add task watchdog control plane (#8339) 2026-06-19 15:38:52 -05:00
task-watchdogs.ts [codex] feat(watchdog): add task watchdog control plane (#8339) 2026-06-19 15:38:52 -05:00
teams-catalog.ts [codex] Add teams catalog extraction (#7550) 2026-06-05 12:55:49 -05:00
trust-preset-resolver.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
work-products.ts Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
work-timeline.ts Harden work timeline security filters (#8923) 2026-07-03 05:19:14 -05:00
workspace-file-resources.ts Add workspace file downloads 2026-06-26 06:05:57 -05:00
workspace-operation-log-store.ts Add workspace operation tracking and fix project properties JSX 2026-03-17 09:36:35 -05:00
workspace-operations.ts fix: upstream deployed document-comment, routine-annotation, workspace & board-polling fixes (#8536) 2026-06-23 09:00:14 -05:00
workspace-realization.ts Add sandbox environment support (#4415) 2026-04-24 12:15:53 -07:00
workspace-runtime-read-model.ts Fix workspace runtime state reconciliation 2026-04-04 17:48:54 -05:00
workspace-runtime.ts Add workspace branch ancestry diagnostics (#9117) 2026-07-06 16:29:01 -07:00