Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

36.2 KB
Raw Blame

SDK-only secret resolution, the four denial causes, the handshake lock, parent-side route pinning, and the config TUI tab.

Extracted from CLAUDE.md (v7.64.0). Indexed in README.md.

1Password Integration (v7.6.0+)

All 1Password logic lives in packages/cli/src/providers/onepassword.ts (dependency-light: imported by index.ts before heavy deps; uses only node built-ins at module load). Secret operations are SDK-only — the @1password/sdk is dynamically imported (await import inside defaultSdkClientFactory) only when SDK auth is present AND a secret/field/environment is actually needed — a normal run never loads the ~10MB WASM. Requires the beta @1password/[email protected] (exact pin): the stable 0.4.0 has no environments API.

Resolution model: SDK-ONLY (no op CLI for secrets)

  • All three operations — resolving op:// refs (secrets.resolveAll), glob field discovery (vaults.list → items.list → items.get), and Environments (environments.getVariables) — go through the SDK. There is no op CLI fallback.
  • Public async entry points: resolveSecrets(), readEnvironment(), discoverItemFields()/resolveGlobImport(). All accept { sdkFactory?, auth?, env? }; acquireSdkClient() is the shared "resolve auth → build client → hard-fail if no auth" helper.
  • Hard-fail on any failure including no-auth (explicit opt-in via op:// or --op-env); zero cost (no SDK/op touched) when no op:// source is present.
  • The one remaining op binary touch is an optional, read-only op account list --format=json (defaultOpAccountLister) used SOLELY for the multi-account picker — it never sees a secret and degrades to an actionable error when op is absent.

Auth resolution (DesktopAuth account selection)

detectSdkAuth(env) is env-only: OP_SERVICE_ACCOUNT_TOKEN → token; else OP_ACCOUNT → DesktopAuth. The richer resolveSdkAuth(opts) (async, called once by index.ts and memoized via getSdkAuth(), so a multi-account user is prompted at most once per run) resolves in order: token → OP_ACCOUNT → onepasswordAccount config (global ~/.claudish/config.json, local .claudish.json wins) → single auto-detected account (op account list) → interactive picker (multiple accounts + TTY; the choice is saved to global config) → hard-fail (multiple accounts non-interactive, or op absent). The account URL (e.g. my-team.1password.com) is the saved/OP_ACCOUNT value — it's unique even when two accounts share an email. The SDK cannot reuse an interactive op signin session, so an op signin-only setup must now set OP_ACCOUNT (DesktopAuth) or a service-account token.

Locked-screen denial recovery (v7.20.0+)

1Password returns the SAME error for two different situations: the user saw the desktop approval dialog and clicked Cancel (a decision), and the Mac was locked so the dialog could not be shown at all and 1Password auto-denied (an environmental condition). Both read Denied authorization for SDK client, which is why isTransientSdkError pins any denial as TERMINAL — retrying a Cancel re-opens the dialog the user just dismissed (the "second dialog" bug, commit aa71ce3). That guard is unchanged.

The ambiguity is resolved from OUTSIDE the error, by probing screen-lock state: defaultScreenLockProbe runs ioreg -n Root -d1 -a and matches CGSSessionScreenIsLocked (present only while locked; ~15ms; darwin-only — other platforms return false and keep terminal behavior). isLockedDenial(err, env) = denial && no OP_SERVICE_ACCOUNT_TOKEN (token auth never shows a desktop prompt, so waiting would be theatre) && screen locked. withSdkRetry now wraps the transient-IPC loop (withSdkTransientRetry) in an OUTER lock-round loop, keeping the two time domains separate: the inner loop owns millisecond-scale IPC blips (150ms·attempt), the outer owns the human-scale "go unlock your Mac" wait. Every non-locked-denial error propagates from the inner loop unchanged.

On a locked denial the user gets a friendly explanation (printed ONCE, on round 1 — re-explaining every 10s reads as nagging) plus a 10-second countdown, up to LOCK_RETRY_ROUNDS (3) → 3 retries ≈ 30s. The countdown breaks early the moment the probe reports unlocked, so approving is immediately followed by the prompt. Cancellation degrades by CAPABILITY, not by mode (interactive and non-interactive must behave identically — an explicit product decision): TTY stdin → Esc/q/Ctrl-C; otherwise Ctrl-C via SIGINT. The live \r\x1b[2K redraw and ANSI styling apply ONLY when process.stderr.isTTY (checked at call time, not module load) — under an MCP host or MCP session stderr is a captured pipe, which gets one static line per round instead. Test seams: setScreenLockProbe() and setLockRetryTiming({seconds, tickMs}) — the latter is MANDATORY in tests or the suite gains 30 real seconds.

A THIRD recoverable cause: peer. LockCause is now "screen" | "app" | "peer". A peer denial is another LIVE claudish holding ~/.claudish/op-handshake.lock — a sibling standing at the 1Password prompt right now. It is EVIDENCE, not inference: the lock is written O_EXCL by exactly one process, carries its pid, and is removed the instant its handshake returns, so a live foreign holder means precisely "wait and you will get your turn". It cannot be confused with a real Cancel, because a Cancel happens INSIDE the holder's own handshake and the denied peer holds nothing — so the aa71ce3 guard is untouched. Precedence is screen → app → peer: waiting behind a sibling is pointless while the Mac is locked, since the sibling cannot finish either.

setPeerLockProbe() is MANDATORY in any test asserting a denial is terminal. The default probe reads a real file under ~/.claudish, so without the seam the verdict depends on whether an unrelated claudish happens to be mid-handshake — which is how the seam came to exist: a sibling worktree's live run turned "unlocked denial is terminal" into a 30-second countdown, and the 1Password suite from 4.8s into 35.8s.

The countdown offers an exit as well as a wait. countdownForUnlock returns "retry" | "cancel" | "skip". s (TTY stdin) → skip, which sets process.env.CLAUDISH_DISABLE_OP=1 so 1Password is skipped for the REST OF THE RUN — a bare model name walks a routing CHAIN, so one refusal otherwise buys three more countdowns for the same run. Reusing that existing kill switch means no second flag to keep in sync, but it required moving the CLAUDISH_DISABLE_OP test OUT of computeHasOpSources and to the top of hasOpSources, ahead of the sniffed memo: by the time a denial has happened the memo is certainly populated, so behind it the skip silently did nothing.

The raw SDK error is never shown. humanizeOpError maps a denial to its cause (your Mac is locked… / the 1Password app is locked… / another claudish process is holding the 1Password prompt / …was dismissed (or never answered)) and strips the Rust Error { msg: …, inner: None } wrapper from everything else. DISPLAY ONLY — recordOpFailure still stores the RAW message, because wasOpAuthorizationDenied matches on that wording.

Concurrent-spawn denial prevention (v7.22.0+)

A THIRD situation produces the same Denied authorization for SDK client, and unlike the two above it is neither a decision nor a lock state: several claudish processes racing the DesktopAuth handshake at once. 1Password arbitrates that handshake across the whole MACHINE, not per process — it authorizes ONE client and instantly denies every concurrent peer. runSdkExclusive serializes SDK calls WITHIN a process (the -4 IPC fix), but team-orchestrator.ts and create_session spawn N sibling PROCESSES, each building its own client, and no in-process queue can span those.

Measured on a real 7-model team run (session team-20260729-163623): all seven children spawned within 6ms, five hit the denial, and only the models whose key was already in the shell env survived — errors/01.log shows a model that COMPLETED while still logging two denials. Reduced repro with lock state held constant (unlocked in both arms): 6 children in a tight loop → 5 denied; the same 6 staggered 4s apart → 0 denied; a single child → fine. So this is not the locked-screen case and the lock probe does not fire for it (isLockedDenial requires a locked screen, and a denial while unlocked stays TERMINAL).

The fix PREVENTS the race rather than recovering from it: auth/credentials/prehydrate.ts's prehydrateCredentialsForSpawn(models) runs validateApiKeysForModels in the PARENT before any child is spawned. The authority write-throughs each resolved op:// key into process.env (api-key-credential.ts), children inherit process.env, so they find the key in step 1 of the chain and never construct an SDK client at all — exactly the state the surviving models were already in. One serialized resolve, one handshake, regardless of model count (a 1Password Environment is fetched once per process via the single-flight memo). Called at both spawn sites; NEVER throws (a credential that cannot be pre-resolved just stays missing and the child reports it as before — failing the spawn would turn "one model has no key" into "the whole team run died").

This covers every spawn site claudish owns, but it is not the whole fix — see the next section.

The denial is SELF-AMPLIFYING, and the handshake lock (v7.25.0+)

Measured 2026-07-31 with a bare @1password/sdk probe — no claudish in the picture, screen unlocked, app unlocked (ai-docs/sessions/op-denial-rootcause-20260731-153357-90bf2332/): 1 process → authorized; 6 concurrent → 1 authorized, 5 denied in 945–1029ms; 6 concurrent behind a cross-process lock → 6 authorized, 0 denied. Two structural facts came out of it: the denial fires on createClient() — the handshake, not the secret fetch; and an already-authorized client is not revoked when a peer authorizes. So the lock needs to cover the handshake ONLY.

1Password's own log names the mechanism:

WARN  [1P:op-automated-unlock/src/lib.rs:620] Suppressing Automated Unlock for 15s.
      Too many denied attempts in a short time period.

The handshake is gated by Automated Unlock, and a burst of denials trips a 15-second global suppression during which EVERY request is denied instantly — including sequential ones from unrelated processes. One race poisons the next 15 seconds for all of claudish, which is why the failures looked erratic and why a single collision could cost a team run several models. It also confounds naive A/B measurement: an arm run seconds after a failing arm measures the penalty box, not the change. Separate measurement arms by ≥40s. Denial latency is a real discriminator — suppression returns in ~190ms, a successful authorization takes ~1.5–1.9s, a human Cancel takes seconds.

Two additions, both preventive:

  • providers/onepassword-handshake-lock.ts — withHandshakeLock() wraps createClient() in defaultSdkClientFactory, DesktopAuth only (a service-account token is authorized by its value; there is nothing to arbitrate). O_CREAT|O_EXCL at ~/.claudish/op-handshake.lock, jittered poll, dead-holder detection via kill(pid, 0), 120s stale-steal (generous ON PURPOSE — the handshake can block on a human clicking Authorize, and stealing mid-approval recreates the race), 45s acquire timeout then proceed unlocked. Never throws, never blocks a run indefinitely: the lock is an optimisation of WHEN, not a gate on WHETHER. CLAUDISH_NO_OP_HANDSHAKE_LOCK=1 bypasses; CLAUDISH_OP_LOCK_TRACE=1 emits one stderr line per transition — added because a lock that silently fails to engage is indistinguishable from no lock, which is exactly how the confounded arm above was caught. This closes the INDEPENDENT-process case that no parent/child protocol can reach. Test seams: setHandshakeLockTestSeams({path, timing}) — MANDATORY in tests or the suite inherits the 45s timeout.
  • The CLAUDISH_OP_UNAVAILABLE skip-list — pre-hydration only covers keys 1Password CAN supply. A bare model name filters a CHAIN; the parent short-circuits at the first credentialed candidate while each child walks the chain from the top, so candidates 1Password has nothing for still send every child to the SDK. op-source.ts records the names a CLEAN resolve came back empty for; prehydrateCredentialsForSpawn publishes them to children, and children drop those names before resolving. Published ONLY when getOpFailures() is empty — a denial also produces an empty resolve, and publishing that would teach every child that a key the user really does store in 1Password is permanently absent, turning one transient denial into a run-wide outage. Children apply the INHERITED list only; within a process a miss stays uncached, as api-key-credential.ts intends.

Concretely, on the developer's own config the Environment holds CODING-PLAN credentials — GLM_CODING_API_KEY (claudish's gc@ GLM Coding Plan provider, alias ZAI_CODING_API_KEY) and GOOGLE_GEMINI_API_KEY — while the chain for a bare glm-* / gemini-* name also probes the PAYG names ZHIPU_API_KEY / GLM_API_KEY / GEMINI_API_KEY. Those are different credentials on different billing plans, not misspellings of each other: they are absent from the Environment because they genuinely do not belong there, and aliasing one onto the other would silently bill the wrong plan. So the PAYG lookups can never resolve, and before the skip-list every child opened an SDK client to chase them.

Not built: retrying a denial once the 15s suppression expires. isTransientSdkError pins denials as TERMINAL to prevent the "second dialog" bug (aa71ce3), and relaxing that needs its own decision; the ~190ms latency signature is the evidence that would justify it. (The peer cause above is NOT this: it waits on positive evidence of a live lock holder, not on a latency guess, and it never retries a denial that could have been a Cancel.)

Parent-side route pinning — one dialog per multi-model run (v7.38.0+)

Pre-hydration hands the child the KEY but still passed a BARE model name, and a bare name is a routing CHAIN. validateApiKeysForModels asks the authority about the one provider resolveModelProvider picked and stops there — rescueRoutableResolutions only walks the rest when that first verdict was already "missing" — so every candidate the parent never queried is still a miss in the child, api-key-credential.ts:160's hasOpSources() gate fires, and the child builds its own client. That is the dialog. withHandshakeLock works exactly as designed here, which is what makes it visible: N children become N SEQUENTIAL dialogs rather than 1 dialog + N-1 denials.

Measured from real session logs (ai-docs/sessions/dev-feature-parent-resolve-20260806-000350-abc216c5/baseline-evidence.md): 17 create_session children logged Denied authorization for SDK client. 16 survived — each found a key later in the chain — so the cost was mostly DIALOGS, not outages; the one casualty, glm-5.2, died in 0.6s chasing ZHIPU_API_KEY while the credential that actually works is GLM_CODING_API_KEY. All 17 came from the spawn site that DOES pre-hydrate, which is precisely what proves pre-hydration alone is insufficient. The skip-list above cannot close it either: recordOpUnavailableVars records only the names a CLEAN resolve actually ASKED for, and the parent never asked — and it is additionally suppressed whenever the run logged any op failure, i.e. exactly when it is needed.

The fix is that the parent resolves the ROUTE as well as the credential. prehydrateCredentialsForSpawn returns SpawnPlan { pinned: Map<bare, "provider@model"> }, and children spawn with the explicit spec. parseModelSpec().isExplicitProvider is then true, so the child's routing step is skipped, it has exactly one candidate, that candidate's key is already in the inherited env, and resolveFromEnvConfig() returns at step 1 — hasOpSources() is never reached. No CLAUDISH_OP_PREHYDRATED marker was added and none is wanted: once the key is in env the op path is structurally unreachable, so a marker would guard a door already welded shut.

ORDERING IS LOAD-BEARING. Phase A (hydrate) must precede phase B (route), because route()'s own credential filter reads the env phase A writes. Reversed, every candidate is a miss and route() itself re-enters the SDK for candidates hydration would have satisfied — the same storm, relocated into the parent. That is why the pin lives inside prehydrate.ts rather than at the call sites.

Two traps, both found during implementation and both pinned by tests:

  • Route.modelSpec is NOT argv-safe for OpenRouter. buildRoutingChain emits a bare catalog-resolved id there (x-ai/grok-4.20) because inside the proxy the sibling provider field disambiguates it; on argv the string must describe itself. parseModelSpec("x-ai/grok-4.20") → provider x-ai, isExplicitProvider FALSE — so an un-normalized pin silently NO-OPS for the most common primary in the default rules. Hence normalizePinnedSpec (→ or@x-ai/grok-4.20), verified 29/29 over PROVIDER_TO_PREFIX.
  • Natives must never be pinned. route("opus") answers ok: openrouter — defaultProvider is appended to EVERY bare chain — and create_session does not screen natives the way team's setupSession does, so an unguarded pin would spawn --model or@opus. isRoutablyPinnable mirrors the child's own step-2c gate; mutation-tested, removing the guard really does yield or@opus.

Note also that parseModelSpec STRIPS a concurrency suffix ([email protected]:3 → model llama3.2), so what protects those specs is the explicit-spec EARLY-OUT, not lossless round-tripping.

The trade, stated honestly: MCP-spawned children lose in-child provider fallback — one candidate, not a chain. Acceptable because the parent already credential-filtered the chain, and a failure surfaces as one model reported FAILED in the team report rather than a dead run. Interactive claudish --model X is UNTOUCHED — full chain as before. Escape hatch: prehydrateCredentialsForSpawn(models, { pin: false }), which is also used automatically for create_session with a work_dir outside the parent's cwd, because route() reads project-local config relative to process.cwd() and would otherwise decide with the wrong project's rules (process.chdir() is not an option — process-global, races concurrent calls).

Verified live (verification-live-run.md, same session dir): keys stripped, 3 bare models, dev tree. Parent = 1 op:client-handshake, 0 denials. All 3 children AND their 3 --mcp grandchildren = 0 handshakes, 0 denials, 0 op:* spans, each reporting auth none with its startup-trace table PRESENT — so the zeros are measured, not missing output. Children's argv captured as [email protected], [email protected], kc@k3. Exactly one dialog for the whole run. Context windows were confirmed identical bare-vs-pinned across 4 models, including the kimi-k3 → kc@k3 subscription wire-id translation.

1Password failure provenance

Every op-source failure is deliberately NON-FATAL (warn + skip, so a broken import can never lock the user out). That meant a denied authorization surfaced downstream as a plain "missing key" error telling the user to export a credential they already store in 1Password. recordOpFailure() / getOpFailures() / renderOpFailureNotice(envVar) in onepassword.ts are the negative counterpart to recordOpHydratedVars (same run-scoped, in-memory rationale), recorded at all four non-fatal catch sites in op-source.ts. getMissingKeyError splices the notice ABOVE the generic remediation and switches its header to "Or set the key directly:" — when a key lives in 1Password, approving is the fix and exporting a literal is the bypass. The record is deliberately COARSE (run-scoped, not per-env-var): an Environment fetch is all-or-nothing, so when it fails claudish genuinely cannot know which variables it would have supplied. Output is byte-identical to the old error when no failure was recorded, so non-1Password users see no change.

Glob field import

A top-level onepassword: string[] config array holds glob paths. isGlobImport() detects a * in the post-item path segment(s); resolveGlobImport() does three phases: discover field names via the SDK (vaults.list → items.list → items.get, matching by title; duplicate titles → first-match + stderr warn) → filter by section-glob + field-glob (globToRegExp) → resolve only survivors via resolveSecrets (batched, in-memory). The SDK's ItemField has no ready-made reference, so each field's op:// ref is synthesized from the vault/item/section/field titles. The SDK decrypts every field value to list names — no different from op item get, which also decrypts everything in-process; we keep only a hasValue flag, never the value. Field labels are trimmed; invalid env-var names are skipped with a warning.

Custom-endpoint op:// apiKeys (pre-resolved at startup)

Provider construction is synchronous and can't await the async SDK, so a custom endpoint's op:// apiKey is pre-resolved in index.ts applyCustomEndpointOpKeys() into CUSTOM_<sanitize(name)>_KEY (UPPERCASE, non-alphanumerics → _). custom-endpoints-loader.ts's createHandler reads process.env[apiKeyEnvVar] first, falling back to resolveCustomEndpointApiKey() (which now only expands ${VAR}/literals — it no longer touches 1Password).

CLI surface (onepassword-command.ts)

  • claudish --op "op://.../*" --list → opPreviewCommand(glob, { auth }): lists matching field names via SDK items.get, never values.
  • claudish --op "op://.../*" [...args] → applyOpImport(): resolves glob → hydrates process.env → runs a normal session with the remaining args (inline mode is glob-only; single refs go in config).
  • --op-env <id> → 1Password Environments via the SDK environments.getVariables (beta-only). Point-of-need since v7.16.0: registered as a lazy op source (like config onepasswordEnvironments[]) and resolved by the credential authority ONLY when a routed provider's key misses env/config — no longer resolved eagerly at startup (which prompted on --update/--version/OAuth-only sessions and stormed across spawned children), no longer a highest-priority overwrite (env/config already set wins).

TUI surface — the "1Password" tab (claudish config, tab 5)

The OpenTUI config interface (packages/cli/src/tui/) exposes a dedicated 1Password tab managing, at both global (~/.claudish/config.json) and project (./.claudish.json) scope: the onepasswordAccount, per-item op:// refs + glob imports (onepassword[]), and 1Password Environments (onepasswordEnvironments[], a NEW persisted config field mirroring --op-env).

  • Persistence: providers/onepassword-config.ts — scope-aware, config-only (no SDK at module load), all SYNC with an injectable OpConfigPaths test seam. Both scopes use a raw read-modify-write (preserves unrelated keys; never routes global through profile-config's cached-homedir() CONFIG_FILE, so global is hermetically testable). index.ts's readConfiguredOnepasswordAccount/saveOnepasswordAccount now delegate here. Point-of-need (v7.16.0): applyOpEnvironment() no longer resolves anything — it only validates the --op-env flag shape; both onepasswordEnvironments[] config and the --op-env flag are discovered + resolved LAZILY by auth/credentials/op-source.ts (registeredEnvironmentIds = seam-aware config env ids + argv --op-env; resolveEnvironmentShared = single-flight, whole-environment getVariables cached into resolvedCache) only when a routed provider key misses env/config. onepasswordEnvironments is added to profile-config.ts's loadConfig allowlist so global round-trips preserve it, and to op-source.ts's SniffedConfig so tests can inject it through the existing seam.
  • TUI wiring: tab/mode/types in tui/types.ts (OpEntry/OpScope/OpKind); tui/components/OnepasswordContent.tsx (auth card + merged scope-marked scrollable list — ▴ project / • global / · env), OnepasswordDetail.tsx (browse-only entry detail), and OnepasswordModal.tsx (the centered absolute-overlay add-wizard — position="absolute" + zIndex, painted as the topmost sibling of the root box, NOT crammed in the bottom strip). App.tsx owns state + the keyboard handler. Scope model mirrors Routing; pickers follow the Profiles <select> pattern (focused <select> owns ↑↓ via onChange; useKeyboard owns Enter/Esc).
  • Add wizard flow (a key) — browse, don't type: Step 1 scope (global/project) → Step 2 account picker (shown ONLY when !detectSdkAuth() AND resolveDesktopAccount() returns needsPicker, i.e. >1 account & not authed; auto-skipped otherwise) → Step 3 kind (intent-labeled <select> with descriptions ON: "API key from an item" / "Environment") → Step 4 value:
    • API key → per-level pickers pick_op_vault → pick_op_item → pick_op_field (from listVaults/listItems/discoverItemFields — two tiny new engine exports listVaults/listItems mirror discoverItemFields' acquireSdkClient). The op://Vault/Item/[Section/]Field-or-* path is built from the literal titles (buildFieldOptions in the modal) — the user never types op://. Globs always target ONE concrete vault+item (the grammar forbids multi-vault/item globs). Each level shows a "◌ Loading…" state while the async SDK call runs; Esc steps back one level (field→item→vault→browse). Inline fuzzy filter: the vault/item/field (and account) pickers are MANUALLY rendered (not <select>) so App owns ↑↓ + a shared opFilter string — typing narrows the list via fuzzyMatch (case-insensitive subsequence, in OnepasswordModal.tsx), backspace widens, a "filter: … N matches" header + "no matches" empty state show state, and the filter resets on every level entry/exit. * is excluded from filter input (isFilterChar) — it'd match literally in the subsequence filter and exclude every concrete-field row.
    • Grouped field picker (buildFieldOptions → FieldPickerOption with a selectable flag): rows are ★ Import everything (all N fields), then per-SECTION groups — a non-selectable header = the section title (often the user's key name, e.g. GOOGLE_GEMINI_API_KEY), then a nested ↳ import all N fields glob, then each concrete field — then a (no section) group for top-level fields. This replaced the confusing flat section 'X' — all fields (*) rows (when a user keeps one key per section, the header now reads as the key group, not gibberish). The cursor SKIPS header rows (App's nextSelectable/firstSelectable + a useEffect cursor-snap; Enter guards on chosen.selectable). The selected option's full op:// path renders on ONE fixed "saves: …" footer line, mid-truncated (midTruncate) so it never wraps/overlaps rows.
    • Environment → typed ID (the SDK has no way to enumerate Environments — only getVariables(id)) with a two-Enter NAME preview: Enter#1 → readEnvironment → render variable names (no values); Enter#2 → persist.
  • Importable-only, FLAT field list (buildFieldOptions): only importable fields are shown — concealed (SDK fieldType === "Concealed", case-insensitive) AND a valid env-var name; everything else (notes/username/credential) is hidden, and sections with zero importable fields are omitted. The list is flat and uniform (no headers/gaps — earlier grouped/collapsed layouts made single-key and multi-key sections look like different items): one selectable key row per field, rendered ENVNAME · section (env-var name green, section a dim aligned tag). A MULTI-key section additionally gets one ↳ all of <section> (N, auto-updates) glob row after its keys; the sectionless ★ All top-level keys (N, auto-updates) glob is appended only when importable top-level keys exist. renderFieldPicker renders this in a bordered scroll region with ▲/▼ more indicators; the selected option's full op:// path shows on the fixed "saves: …" footer (midTruncated, dialogW - 16, so it never wraps).
  • SDK call SERIALIZATION (-4 fix): the 1Password SDK's WASM↔desktop-app IPC bridge is NOT safe for concurrent calls on a shared client — two ops in flight at once corrupt the channel → IPC operation failed: -4. The config TUI fires overlapping calls (e.g. a post-save confirm AND the main-list glob-expansion at the same instant), which reliably triggered it. Fix in onepassword.ts: a process-wide runSdkExclusive queue chains every SDK op so at most one runs at a time, plus withSdkRetry (cache-reset + 150ms·attempt backoff, up to 3 attempts) for genuinely transient blips, plus the per-auth client cache (defaultSdkClientFactory, one desktop handshake reused). isTransientSdkError also matches stale-desktop-session errors (invalid client id / invalid session / session expired / unauthorized / token expired) — after an idle period 1Password expires the SDK session and the cached client's id goes invalid; these are retryable (reset cache → rebuild client = fresh DesktopAuth handshake → retry), so claudish self-heals after idle instead of surfacing invalid client id. (The desktop app's re-authorization prompt after idle is 1Password's own session-timeout behavior — claudish can't suppress it, but now auto-retries once approved.) ALL TUI SDK calls (loadOpVaults/Items/Fields, runOpAdd confirm, testOpEntry, previewOpEnvironment, the opExpansions effect) go through withSdkRetry → serialized. Serialization is the PRIMARY fix; the client cache + retry are secondary. Tests: withSdkRetry serialization (max-concurrency=1), retry-then-succeed, give-up-after-3, no-retry-on-genuine-error.
  • Field-load speed: the field picker uses discoverItemFieldsById(vaultId, itemId, vaultTitle, itemTitle) — ONE items.get SDK call instead of discoverItemFields' three (vaults.list → items.list → items.get), ~3× faster on the 1Password desktop-app IPC path. Results are cached per ${vaultId}:${itemId} in opFieldsCache (a useRef Map), so re-entering an item is instant (no spinner). The latency is desktop-app IPC + WASM load + decrypt (not a network call), so caching + the single-call path are the real wins. discoverItemFields (title-based, 3 calls) is retained for runOpAdd's confirm + the main-list glob expansion, which don't have the IDs handy.
  • User-facing terms (no jargon): the main list + detail use key (single ref), set (a glob = many keys), environment — never "ref"/"glob". The KIND column color-codes them (key=blue, set=yellow, env=cyan); the auth card summarizes "N keys / M sets / K environments".
  • Sets auto-expand in the main list: each glob entry resolves its key names + a MASKED value tail lazily via a cached opExpansions effect (discoverItemFields+filterGlobFields, keyed by glob value) and renders them as dim ↳ NAME ••••XXXX sub-rows (with ◌ resolving… / ✗ error states). The tail is DiscoveredField.valueTail — the LAST 4 chars of the value, captured at discovery (where the SDK has already decrypted in-process) via the exported valueTail() helper; the full value is never stored/returned/logged. This is the standard "••••1234" identification pattern so the user can confirm WHICH credential is wired up. (The op keys themselves ARE applied to providers — they hydrate process.env at startup via loadStoredApiKeys, and the Providers tab reads process.env[apiKeyEnvVar]; an earlier "providers show not set" report was the -4 concurrency bug, now fixed by SDK serialization.) Both the main list and the field picker render selected rows as a height-1 highlight box and non-selected rows as bare <text> (transparent → no dark/blue strips; the earlier flexGrow row box painted the whole panel). The field picker's list sits in a bordered scroll region with ▲ N above / ▼ N below indicators.
  • Glob grammar (claudish-side only — 1Password rejects */** outright, so it never sees them): op://V/Item/* = sectionless/top-level fields only; op://V/Item/Section/* (or */*, M*/*, *_KEY/*) = fields in matching section(s) only; op://V/Item/** = the WHOLE item — every importable field, sectioned AND sectionless (the matchAll flag on GlobImport, added because no */*/* form unions both axes). parseGlobImport maps a lone single-segment ** → {sectionGlob:null, fieldGlob:"*", matchAll:true}; filterGlobFields short-circuits the section check when matchAll. ** is purely additive — *'s sectionless-only meaning (and its pinned test) is unchanged.
  • ★ rows in the field picker (buildFieldOptions): ★ All keys in this item (N) → op://V/Item/** is shown first whenever the item has ≥1 importable key — ONE config entry covers every item shape (no-sections / all-sectioned / mixed). A second ★ All top-level keys → op://V/Item/* appears ONLY for a MIXED item (has sections AND top-level keys), as a narrower pick; it's suppressed for a no-sections item (where ** already equals *). Both counts reflect importable fields only. This replaced an earlier ★ All top-level keys-only design that couldn't express "the whole item" when keys live in sections.
  • Startup glob failures are NON-FATAL (index.ts loadStoredApiKeys): a saved glob that matches nothing (e.g. after a 1Password item edit) now warns + skips per-glob instead of process.exit(1) — a bad import must never lock the user out of claudish (especially claudish config, where they'd go to fix it). Genuine auth/token failures still hard-fail via the single-ref resolveSecrets path.
  • Hydrate-on-add (keys apply WITHOUT a restart): after a successful add, runOpAdd resolves the new ref/set/environment and gap-fills the values into the running process's process.env (env already set wins, same rule as startup), then drops all probe handler caches (invalidateProbeProxyHandlers()) and refreshConfig(). The Providers tab reads process.env[apiKeyEnvVar], so the imported keys light up immediately in the same session — previously they only appeared after relaunching claudish (the import only hydrated env at startup). Sets use resolveGlobImport (returns the {envVar:value} map directly — one resolution both confirms and hydrates); refs use resolveSecrets + envNameFromOpRef; environments use readEnvironment. The status line reports "N keys applied".
  • runOpAdd is PERSIST-FIRST: it writes the ref/glob/env to config immediately (the picked option is valid by construction — it came from an SDK-discovered list), then runs a non-fatal confirmation test (resolveSecrets/discoverItemFields+filterGlobFields/readEnvironment) that only annotates the status line (masked value / key count / var count) — a flaky second SDK round-trip can no longer silently lose the save. A genuine persist failure (or the confirm error) is logged to stderr and shown in the status line. (Earlier bug: re-validating before persist meant a thrown confirm left onepassword[] empty — "Imports: 0" despite a successful pick.) Auth still resolves via resolveSdkAuth (in-TUI multi-account picker via pick_op_account + deferred-promise onNeedsPicker); the heavy SDK/WASM stays lazy.

Tests

onepassword.test.ts — hermetic via injectable SdkClientFactory (fake client answering vaults/items/secrets/environments) and OpAccountLister (fake account list) seams; neither the op binary nor the real SDK is ever invoked. The SDK-shaped item fixture is derived from the real-captured CLI item fixture (no hand-crafted secret-like data). Covers no-auth hard-fail and resolveDesktopAccount/resolveSdkAuth (env / config / single-auto / multi-picker / multi-error). onepassword-config.test.ts — hermetic via the OpConfigPaths seam pointing global/project at temp files (homedir() can't be re-pointed at runtime in Bun); covers scope-independent account/imports/environments read-write, project-then-global precedence, idempotent add, empty-list key deletion, readAllOnepasswordEnvironments dedup, raw-merge preservation of unrelated fields, and garbled-file tolerance.