paperclip/packages/adapter-utils/src
Nicky Leach c647b8cc2e
feat(acpx-engine): give sandbox.exec spans real parents (#10852)
## Thinking Path

> - Paperclip uses spans and traces to show how work moves through
agents and tools
> - sandbox.exec spans need a real parent so the trace tree matches the
work tree
> - Wrong parent links make execution history hard to read and hard to
debug
> - This pull request adds a single task.run root span and re-parents
live work to the nearest active span
> - The change keeps detached work under the closest live span instead
of the HTTP root
> - The benefit is a clear trace tree for sandbox.exec work and better
execution diagnosis

## Linked Issues or Issue Description

**What happened?**

sandbox.exec spans attached to the wrong parent or to no live parent in
some paths.

**Expected behavior**

Each sandbox.exec span should attach to the nearest live span.

**Steps to reproduce**

1. Run work that creates sandbox.exec spans during startup and callback
bridge paths.
2. Inspect the trace tree.
3. Observe an orphaned span or a span with the wrong parent.

**Paperclip version or commit**

`672e9de9c8b004aebc1f08e24b612ab067735ad1`

**Deployment mode**

Local dev.

**Additional context**

The branch adds the task.run root span, parents sandbox.startup to it,
and re-parents detached bridge work to the nearest live span.

## What Changed

- Added a task.run root span for the run tree.
- Re-parented sandbox.startup, agent.turn, and detached bridge work to
the nearest live span.
- Added end-to-end trace-tree assertions for the full parent chain.
- Added negative coverage so sandbox.exec does not parent to the HTTP
root.

## Verification

- Focused Vitest suite passed:
`packages/adapter-utils/src/acpx-engine/execute.test.ts`,
`packages/adapter-utils/src/acpx-engine/startup-timing.test.ts`,
`packages/adapter-utils/src/execution-target-sandbox.test.ts`,
`packages/adapter-utils/src/sandbox-callback-bridge.test.ts`, and
`server/src/__tests__/environment-execution-target.test.ts`.
- Result: 5 files passed, 204 tests passed.
- The submitted branch also reported `adapter-utils` checks, `server`
seam checks, and `tsc` exit 0 in the handoff state.

## Risks

- This change can alter trace tree shape in tools that read parent
spans.
- A missed bridge path could still point to the wrong live span.
- Low risk for runtime behavior, because the change only changes span
parent attribution.

## Model Used

OpenAI GPT-5, tool-use capable.

## 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
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-08-04 15:32:41 -07:00
..
acpx-engine feat(acpx-engine): give sandbox.exec spans real parents (#10852) 2026-08-04 15:32:41 -07:00
test-support feat(mcp) [split 4/8]: wire gateway runtime and Smoke Lab (#9559) 2026-07-14 15:07:30 -05:00
billing.test.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
billing.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
command-managed-runtime.test.ts feat(sandbox): stage referenced projects into the run sandbox (#10469) 2026-07-29 16:09:57 -07:00
command-managed-runtime.ts refactor(observability): stop writing detailed per-step timing to the run log (#10776) 2026-08-03 15:58:21 -07:00
command-redaction.ts [codex] Roll up May 17 branch changes (#6210) 2026-05-17 17:15:06 -05:00
exclude-patterns.ts Fix sandbox git publishing and large workspace uploads (#8422) 2026-06-20 22:03:55 -07:00
execution-target-sandbox.test.ts feat(acpx-engine): give sandbox.exec spans real parents (#10852) 2026-08-04 15:32:41 -07:00
execution-target.test.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
execution-target.ts feat(acpx-engine): give sandbox.exec spans real parents (#10852) 2026-08-04 15:32:41 -07:00
git-workspace-sync.test.ts fix(sandbox): bundle git copy-back against the merge-base so diverged/reset workspaces still import (#10601) 2026-07-31 23:41:42 -07:00
git-workspace-sync.ts fix(sandbox): bundle git copy-back against the merge-base so diverged/reset workspaces still import (#10601) 2026-07-31 23:41:42 -07:00
index.ts fix(codex): warn when sandbox auth is shadowed (#9259) 2026-07-15 10:02:28 -07:00
local-process-sandbox.test.ts fix(adapter-utils): keep sandbox proxy sockets within Linux path limit (#10221) 2026-07-26 10:52:16 -05:00
local-process-sandbox.ts fix(adapter-utils): keep sandbox proxy sockets within Linux path limit (#10221) 2026-07-26 10:52:16 -05:00
log-redaction.ts fix(ui): external adapter selection, config field placement, and transcript parser freshness 2026-04-03 21:11:22 +01:00
mcp-isolation.integration.test.ts feat(skills): import skills from projects (#9620) 2026-07-15 18:01:44 -05:00
remote-execution-env.ts Sanitize remote execution envs at the boundary (#5325) 2026-05-05 19:30:14 -07:00
remote-managed-runtime.test.ts feat(sandbox): stage referenced projects into the run sandbox (#10469) 2026-07-29 16:09:57 -07:00
remote-managed-runtime.ts feat(sandbox): stage referenced projects into the run sandbox (#10469) 2026-07-29 16:09:57 -07:00
runtime-progress.test.ts feat(adapter-utils): add observable sandbox sync progress (#8395) 2026-06-20 13:03:42 -07:00
runtime-progress.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
sandbox-callback-bridge.test.ts feat(acpx-engine): give sandbox.exec spans real parents (#10852) 2026-08-04 15:32:41 -07:00
sandbox-callback-bridge.ts feat(acpx-engine): give sandbox.exec spans real parents (#10852) 2026-08-04 15:32:41 -07:00
sandbox-file-sync.test.ts feat(sandbox): stage referenced projects into the run sandbox (#10469) 2026-07-29 16:09:57 -07:00
sandbox-install-command.test.ts Fix exe.dev sandbox installs for gemini/opencode local adapters (#5737) 2026-05-11 14:28:22 -07:00
sandbox-install-command.ts Fix exe.dev sandbox installs for gemini/opencode local adapters (#5737) 2026-05-11 14:28:22 -07:00
sandbox-managed-runtime.test.ts feat: sync @-mentioned projects into remote sandboxes (confined sandbox transport, flag ON) (#10564) 2026-07-31 13:31:17 -07:00
sandbox-managed-runtime.ts fix(sandbox): bundle git copy-back against the merge-base so diverged/reset workspaces still import (#10601) 2026-07-31 23:41:42 -07:00
sandbox-run-log-stream.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
sandbox-shell.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
server-utils-env.test.ts fix: preserve control plane access in Codex sandbox (#10152) 2026-07-24 15:25:59 -05:00
server-utils.test.ts fix(adapter-utils): correct confirmation wake semantics (#10588) 2026-07-31 18:53:53 -07:00
server-utils.ts feat(observability): add granular OpenTelemetry spans for sandbox startup and execution (#10758) 2026-08-03 10:13:19 -07:00
session-compaction.ts Make ACP the default engine for local adapters (#9238) 2026-07-08 19:05:03 -07:00
ssh-fixture.test.ts perf(sandbox-providers): drop nvm sourcing from exec wrappers (#10443) 2026-07-29 12:40:16 -07:00
ssh.ts perf(sandbox-providers): drop nvm sourcing from exec wrappers (#10443) 2026-07-29 12:40:16 -07:00
types.ts feat(heartbeat): expose cache-adjusted run cost (#10349) 2026-08-01 07:15:52 -07:00
workspace-restore-merge.test.ts refactor(codex-local): relocate Codex auth-merge scripts + decision predicate into the adapter (#9785) 2026-07-17 14:45:36 -05:00
workspace-restore-merge.ts Fix sandbox restore index drift (#8595) 2026-06-24 23:21:13 -07:00