Files
PaperClipAI/ui
Nicky LeachandPaperclip 3f8149066c Fix connection controls for inherited hiring environments (#17944)
<!-- entire-trail-link-start -->
https://entire.com/gh/paperclipai/-/trails/106/changes/paperclip/106
<!-- entire-trail-link-end -->

## Thinking Path

> - Paperclip lets people hire agents and select execution environments.
> - The name and adapter dialog saves an inactive draft before model
connection.
> - That draft can inherit its environment through a null
defaultEnvironmentId.
> - Managed-only and forced Kubernetes policy resolve that inheritance
to an environment ID.
> - The readiness gate compared the stored null with that ID and treated
the selection as unsaved.
> - This change accepts unchanged inheritance and keeps preparation and
save-failure gates.
> - People can select auth, open Advanced, and test a saved account
before finishing setup.

## Linked Issues or Issue Description

**What happened?**

The Connect a model screen disabled all auth controls for a draft from
the name and adapter dialog under managed-only or forced Kubernetes
policy. Reloading did not recover it. The draft had no explicit
environment, which is a valid inherited selection.

**Expected behavior**

Keep connection controls usable once the draft and environment are
ready. Test the saved agent against its resolved environment before
hiring finishes. Continue to block tests during preparation or an
unsaved environment change.

**Steps to reproduce**

1. Enable managed-only execution with a valid instance default, or force
Kubernetes.
2. Open New agent, enter a name, and choose Claude or Codex.
3. Reach Connect a model with the saved draft's defaultEnvironmentId
still null.
4. Try the saved subscription, API-key tile, or Advanced gateway.

This follows #17761. The roadmap and related PR search found no existing
fix for this readiness regression.

## What Changed

- Accept the inherited selection when neither the draft nor the user
specifies an environment.
- Retain the existing preparation, loading, selection-save, and
connection-test gates.
- Cover Claude and Codex under managed plugin, managed sandbox, and
forced Kubernetes policy.
- Extend preparation coverage to both explicit and inherited
environments.
- Add the inherited-draft journey to the feature map.

## Verification

- Hosted reproduction on Core e71a23c01 from a macOS browser: one owned
draft was created through the real name/adapter UI. Its persisted
environment was null. Auth controls were disabled before and after
reload. The instance required managed execution.
- Cleanup used the normal Terminate action. Readback confirmed
lifecycleState=terminated with no lifecycle error. The roster returned
to its original two active agents. No existing agent, task, account, or
instance setting was changed.
- Before the fix, four inherited-connection cases and the inherited
preparation case failed. The explicit-environment preparation control
passed.
- After the fix, 140 tests passed across NewAgent.test.tsx,
test-agent-setup.test.ts, and qualify-claude-setup.test.ts. Coverage
includes same-agent probes before Finish, preparation waits, account
preservation, failed-save retry, stale reads, and runner qualification.
- npm --prefix ui run typecheck passed, including Storybook catalog
generation and tsc -b. Direct UI TypeScript, token gates, map checks,
and git diff --check also passed.
- The pnpm entry point stalled while resolving its pinned version on
this host; both owned attempts were stopped. Running the same UI
typecheck script through npm passed. Full local workspace
typecheck/build were not repeated because Cargo is absent. The
exact-head CI run supplies the full workspace validation.
- Automated CI on f2a5a2df7 passed all checks. Standard review found
only the explanatory source comment, which contributor policy forbids.
The comment was removed in 8f43a6d80, and its thread was resolved. The
runtime expression and tests are unchanged. Fresh CI passes on
8f43a6d80: 55 successful checks and two intentional skips. The full
workflow includes build, typecheck, all test shards, Rust, and
end-to-end checks:
https://github.com/paperclipai/paperclip/actions/runs/40591187819.
Standard Greptile returned 5/5, then Apex returned 5/5 with zero new
comments on the same head:
https://github.com/paperclipai/paperclip/pull/17944#issuecomment-6454535506.
No review threads remain unresolved; the PR is conflict-free.
- The diff was reviewed for secrets, PII, and run artifacts. Evidence
stays outside git.
- No deployment, live post-fix provider test, or VM provisioning was
performed. Component tests simulate API responses; the hosted check
proves the original failure.

## Risks

This changes only how the wizard recognizes an inherited environment. It
does not change the environment resolver, lifecycle, approval policy, or
lease admission. The existing preparation and failed-save guards remain
active. No migration is required. Hosted acceptance of the fix requires
a later authorized deployment.

## Model Used

OpenAI Codex, based on GPT-6, with reasoning, tool use, browser
inspection, and code execution. The exact serving model ID and context
window size are not exposed.

## 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 described the issue in-PR following the bug report fields
- [x] I have not referenced internal or instance-local Paperclip issues
or links
- [x] My branch name describes the change and contains no internal
ticket id
- [x] I have run the targeted tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation
- [x] I have considered and documented the risks
- [x] All Paperclip CI gates are green
- [x] Standard Greptile and Apex are 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-10-27 15:24:29 -07:00
..

@paperclipai/ui

Published static assets for the Paperclip board UI.

What gets published

The npm package contains the production build under dist/. It does not ship the UI source tree or workspace-only dependencies.

Storybook

Storybook config, stories, and fixtures live under ui/storybook/.

pnpm --filter @paperclipai/ui storybook
pnpm --filter @paperclipai/ui build-storybook

Typical use

Install the package, then serve or copy the built files from node_modules/@paperclipai/ui/dist.

Editor dependency identity

Keep the root and workspace overrides for @codemirror/state, @codemirror/view, and @lezer/common aligned. CodeMirror requires shared extension identity, while Lezer parsers and syntax highlighters require shared NodeProp IDs. Multiple Lezer copies can crash code-block highlighting with tags is not iterable. src/lib/codemirror-single-instance.test.ts checks the installed dependency graph and highlights sample code through the editor's real language dependencies. GitHub Actions owns regeneration of pnpm-lock.yaml.