# Workstation AI account Gateway convergence

**Status:** ACTIVE
**Supersedes:** the K3s/Factory portion of `2026-08-22-subrouter-authority-s6.md`
**Base:** current `origin/main` at slice start `ce4f674f372ccacab784ce65b96faeef388d55fa`

## Owner architecture decision

Overdeck is the workstation-management project. AWP owns Factory and future agentic-workspace execution.

For AI accounts on this workstation:

- **Systray AI is the sole user-facing account registry and account manager.**
- Codex (`cdx`), Claude (`cld`), and Claudex resolve the same Systray account slugs/defaults.
- Subrouter is an implementation detail for credential custody attached to a Systray account through `authority_binding`; it is not a second account directory.
- Factory/K3s does not receive or consume Subrouter account authority from Overdeck. The tailnet authority edge is not part of this workstation slice.
- Existing intentional native accounts remain native until the owner explicitly selects **Move to Gateway…**. No existing provider credential is copied into Subrouter.

## Account lifecycle

### Add and select

Existing Systray Add account and default-selection UI remains authoritative for both Codex and Claude. Claudex independently resolves its Codex and Claude selections from those same registries/defaults.

### Move to Gateway

For a native Codex or Claude account, Systray exposes **Move <alias> to Gateway…** in both the tray account-management menu and the dashboard account card.

The action opens the installed `systray-gateway migrate` command in a workstation terminal so the provider-supported login remains visible and interactive. The migration helper performs a fresh authority-owned login; it does not read/copy/import the native provider token file. Systray registers only the non-secret loopback authority endpoint `http://127.0.0.1:31415`, exact route metadata, and the protected route grant reference.

Cutover requires:

1. fresh authority-owned login/provision succeeds;
2. the exact Gateway route reports ready;
3. release-level Codex/Claude compatibility gates for local CLI, resume/streaming, health/repair/restart, exact route, no provider credential copying, and provider-specific protocol paths are already sealed by the Subrouter candidate program.

### Gateway-managed execution

- `cdx` and `cld` execute locally on the workstation with Gateway-only homes/environment and must not enter remote/K3s offload.
- A fully Gateway-managed account fails closed if route/grant/Gateway readiness is missing; no native credential fallback.
- Claudex Codex translation uses an ephemeral private CCP config containing only the exact route grant and no provider refresh token.
- Claudex Claude/native and hybrid modes use the same Systray Claude `authority_binding`; migrated Claude requests route through the exact local Subrouter prefix without opening native Claude credentials.
- Systray health and Repair for bound accounts use the existing authority lifecycle adapter.

### Return to native

Systray exposes **Return to native…**. Rollback is transactional:

1. mark the Gateway binding quiesced and disable the exact route;
2. run Systray's existing provider-native reauthentication UI for a fresh login;
3. verify native health without a model request;
4. remove the Systray authority binding (commit point);
5. remove authority grants/route/account state and protected local grant reference.

A failed pre-commit rollback remains quiesced/authority-bound. No old provider credential is restored or copied.

## UI/state contract

Each Systray account has one custody state:

- `Native`
- `Gateway testing`
- `Gateway`
- `Gateway paused`

The tray account-management submenu exposes the state-appropriate action. Dashboard account cards expose the same actions and show a visible Gateway badge for testing/active/paused states. Locks continue to block new migration/cutover actions.

## Factory/AWP boundary

This slice removes active Factory integration from Systray AI:

- no Factory tray submenu;
- no Factory status polling from Systray;
- no Factory decision notifications from Systray;
- no Factory browser opener from Systray.

Compatibility constructor parameters may remain temporarily to avoid unrelated API churn, but they are inert. Historical Factory modules/plans are not rewritten by this slice; AWP owns the replacement execution product.

The S6 K3s authority transport is removed from Overdeck:

- no `AuthorityRemoteAccess` dispatch object;
- no K3s Subrouter route/grant Secret;
- no K3s `authority_origin` registry field;
- native/unmigrated K3s behavior is restored unchanged until AWP replaces that execution surface.

## Acceptance

Buildbox verification must prove:

1. Gateway account manager supports Codex and Claude stage/activate/cancel with Systray remaining the registry.
2. Metadata-only Gateway status does not initialize authority administration.
3. Gateway activation fails closed on non-ready health.
4. dark cancel deletes authority material and returns the Systray account to Native.
5. Gateway-bound `cdx`/`cld` cannot remote-offload and local execution receives only Gateway environment.
6. Claudex Codex and Claude paths do not read/reconcile native provider credentials when migrated.
7. Claudex hybrid preserves exact local Claude route prefix and host semantics.
8. dashboard/tray Gateway controls update across Native/Testing/Active/Paused and lock/busy constraints.
9. Factory is absent from Systray menu/poll/notification behavior.
10. K3s remote-authority additions are absent while native K3s tests remain green.
11. complete Systray suite has no new regressions beyond already reproduced clean-main baselines.
12. installed runtime has only loopback Subrouter listener; tailnet edge remains disabled.
13. real `zync` remains metadata-only native/unbound; no real account is migrated during implementation acceptance.

## Installed proof

After landing/deploy:

- verify deployed source SHA is landed main;
- verify `systray-ai.service` and `overdeck-subrouter.service` active;
- verify edge disabled and only `127.0.0.1:31415` listening;
- verify `systray-gateway status --tool codex --account zync` reports Native using registry metadata only;
- verify no provider credentials/routes/grants/unresolved attempts exist in Subrouter;
- verify installed Systray menu/dashboard source contains Gateway controls and no active Factory integration;
- verify installed `cdx`, `cld`, `claudex`, and `systray-gateway` links resolve to the canonical deploy tree.

No real account login, model call, migration, repair, or credential read/copy is authorized as part of this implementation proof.
## Pre-land verification evidence — 2026-08-22

No real account login, model call, migration, repair, provider credential read/copy, or authority binding was performed. Live authority remained 0 provider credentials / 0 routes / 0 grants / 0 unresolved attempts with Gateway ready; the tailnet edge remained disabled and only loopback `127.0.0.1:31415` listened.

Current workstation-focused verification on buildboxes:

- targeted account/dashboard/indicator suite: **310 passed**;
- authenticated candidate focused before final installer-gate tightening: **449 passed**, plus Codex+Claude synthetic migration fixture verification PASS;
- authenticated candidate static/module/full: PASS;
- installer + desktop packaging contracts after adding `systray-gateway`: **9 passed**;
- broad Systray suite after installer expectation correction: **1183 passed, 1 skipped, 1 deselected, 1 failed**. The sole failure is `test_store_rejects_malformed_or_unsafe_state`, which reproduces identically from exact current `origin/main` under the same protected buildbox parent and is therefore an inherited permissions-order baseline, not a workstation-account regression. The deselected CPU-spin supervisor test is the previously reproduced buildbox timing baseline.

The final authenticated post-commit candidate must rerun focused/static/module/full with installer/desktop packaging tests included in focused/static before landing.
