Files
PaperClipAI/server
DottaandClaude Opus 5.5 5a683696eb test(antigravity): prove run start keeps the Antigravity gates and hands plugin runs their typed credential (#22943)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The native Runner runs Google Antigravity on this host, on Core
managed sandboxes, and on plugin Runner-task environments such as the
Paperclip Cloud agent computer.
> - #22940 removed the refusals that stopped Antigravity on plugin
Runner-task targets, and the refusal of Google sign-in on remote targets
once the profile is released. That is item 6 of the Antigravity Cloud
rollout plan.
> - Run start must still refuse a pending profile on every remote target
without an operator grant. A plugin Runner-task target must refuse even
with a grant. A released profile must refuse state saved under another
profile version.
> - Existing tests proved these rules at the unit level and at save,
Test and probe time. No test proved them at run start, where a plugin
Runner task is actually launched. No test proved that a released plugin
Runner-task run gets the correct typed credential.
> - This pull request adds a focused run-start test suite for those
rules and marks item 6 done in the plan.
> - The benefit is that a later change cannot silently reopen these
gates or leak the wrong credential to a plugin Runner task.

## Linked Issues or Issue Description

- Refs #22940 (item 6 implementation)
- Refs #22923 (rollout plan)
- Refs #22933 (item 2: sign-in task credential with write-back)
- Refs #22935 (item 3: per-turn harnesses stay per-turn on warm
environments)

## What Changed

- Added
`server/src/services/native-runtime/antigravity-run-start.test.ts`.
Every case except the credential cases runs through
`executePaperclipNativeSession`. The suite sets the release state
explicitly in each test, so the tests stay valid now that the profile is
released.
- Pending, no grant: plugin Runner-task and Core sandbox runs fail with
`paperclip_runner_antigravity_candidate_ineligible`. No plugin task,
task owner or backend starts.
- Pending, with a grant: a positive control shows the grant admits a
Core sandbox linux-x64 run past the gate. The same grant still refuses a
plugin Runner-task run.
- Released: a plugin Runner-task run passes the gate. A run whose saved
state uses an older profile version is refused with
`NativeProviderStateIncompatibleError`.
- Released, credential: through `createRunnerdBackend`, the plugin
Runner task owner receives only `{type: "provider-env", provider:
"antigravity"}` with `GEMINI_API_KEY` (API key) or
`PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET` (sign-in). Ambient
`GOOGLE_*` and `GEMINI_HOME` values do not reach the task. Only the
sign-in run registers its write-back handoff.
- Added a shared `antigravity.test-fixture.ts` (execution builder and a
minimal database stub). `antigravity-release.test.ts` now uses this
fixture.
- The grant in the positive control comes from a stub of the server's
grant resolver. Since the release flip, the Runner's grant parser
refuses every grant for a released profile, so no real grant can be
valid in this build. The stub tests the server rule (a plugin
Runner-task target never takes a grant) on its own.
- Marked item 6 done in
`doc/plans/2026-11-25-antigravity-cloud-rollout.md`.
- No product code changed.

## Verification

- `cd server && npx vitest run
src/services/native-runtime/antigravity-run-start.test.ts
src/services/native-runtime/antigravity-release.test.ts`: 16 passed.
- Server typecheck: no errors in the changed files.
- Red/green. For each rule, I removed the rule and confirmed the
matching test fails. Then I restored the rule and confirmed all 6 tests
pass:
- Lifting the pending remote gate: 3 tests fail (both no-grant cases and
the granted case).
  - Removing the plugin-only refusal: the granted plugin case fails.
- Removing the saved-state profile check: the released saved-state case
fails.
- Restoring the old "no Google sign-in on remote targets" refusal: the
sign-in credential case fails.
- `tests/runner-e2e/source-sdk-public-inputs.json` is unchanged (the
script reports `changed: false`).
- No live runs, Google sign-in, real tokens or paid workflows were used.

## Risks

- Low risk. The change adds tests, a test fixture and one plan line. It
does not change runtime behavior.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
code 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
- [ ] 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 09:32:22 -06:00
..