mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Onboarding signs the first agent in to Claude or Codex through a plugin-managed execution environment that is prepared for the agent (#23312, #23383) > - Core prepares that environment again whenever the draft's execution configuration changes, and refuses a sign-in while it does > - Core detected a change with `JSON.stringify`, so the same configuration saved with its keys in a different order counted as a change. Postgres `jsonb` returns keys in its own order, so an onboarding save of the same choice could re-prepare the environment > - The wizard held sign-in readiness per harness only, so after such a re-preparation it still treated the environment as ready and started a sign-in that Core refused > - This pull request compares configuration independent of key order, and holds readiness per harness and model > - The benefit is that re-picking the saved choice keeps the prepared environment and signs in at once, and a real change waits for its preparation instead of failing ## Linked Issues or Issue Description Refs #23312 and #23383. **What happened?** With a plugin-managed execution environment as the instance default, the onboarding agent was already prepared for Claude (`verifying`). Picking Claude again saved the same configuration. Core moved the agent back to `preparing` and bumped its lifecycle version, and the wizard started a sign-in at once. Core returned `400 login_agent_unavailable` and the card showed that error. **What did you expect to happen?** Saving an unchanged configuration leaves the prepared environment alone, and the sign-in starts. **Steps to reproduce** 1. Make a plugin-managed execution environment that prepares an environment per agent the instance default. 2. Start onboarding, choose Claude with a subscription, and wait until the environment is prepared. 3. Reload onboarding and pick Claude again. 4. See the sign-in fail with the message above. ## What Changed - Agent configuration comparison (`jsonEqual`) uses canonical JSON with sorted keys. This covers the lifecycle's re-preparation check, the changed-field check for configuration patches, and the changed fields recorded in configuration revisions. A save that only reorders keys no longer re-prepares the agent or records a revision field change. - Onboarding holds sign-in readiness per selected harness and model, so a model change waits for the preparation it causes. ## Verification - `pnpm --filter @paperclipai/server typecheck` and `pnpm --filter @paperclipai/ui typecheck`: no errors. - `server`: the agent lifecycle, configuration save and configuration revision suites pass (97 tests). The lifecycle test now saves the same runtime configuration with its keys reversed and asserts the lifecycle version does not change. That assertion fails without the comparison change (`expected 3 to be 2`). - `ui`: the sign-in readiness hook suite passes (4 tests). It already covers a hold-key change waiting for the new preparation. - I reproduced the failure in a running instance and read it from the network log. I did not repeat that sign-in with this change. CI runs the full suites and end-to-end tests. ## Risks - Comparisons that previously reported a key-order-only difference as a change now report none. Every caller wants value equality, so this removes spurious re-preparations and revision entries. - No migration and no API change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), with extended thinking and tool use (code search, shell, tests, browser network inspection) in Claude Code. ## 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>