fix: claude immutable-thinking resume retry, board-key lock-timeout tolerance, cli-auth/me snapshot - #235
Merged
Merged
Conversation
…sume errors Claude rejects resume requests whose transcript contains immutable `thinking`/`redacted_thinking` blocks. Previously only "unknown session" errors triggered a fresh-session retry, so these failures surfaced as hard errors. Add isClaudeImmutableThinkingBlockError detection and fold it into the resume-retry path. Also pass PATH explicitly into the ccrotate command env so account rotation works under restricted execution targets.
Updating last-used on a board API key could throw a Postgres lock-timeout (55P03) under contention and fail the request. Wrap touchBoardApiKey in the same lock-timeout-tolerant handling already used for agent API keys: swallow 55P03 / "lock timeout" errors and log a warning instead of failing auth.
The /api/cli-auth/me handler re-resolved board access via a second DB lookup even though the authenticated actor already carries the resolved identity. Read user, isInstanceAdmin, companyIds, and memberships directly from req.actor instead, dropping the redundant resolveBoardAccess call.
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
What Changed
isClaudeImmutableThinkingBlockError(parse.ts) and folded it into the resume-retry path inexecute.ts, so a resume that fails due to immutablethinking/redacted_thinkingblocks now retries with a fresh session instead of erroring. Also passPATHexplicitly into theccrotate nextcommand env so account rotation works under restricted execution targets.touchBoardApiKeyin lock-timeout-tolerant handling (swallows Postgres55P03/ "lock timeout", logs a warning), mirroring the existing agent-API-key behavior./api/cli-auth/menow derivesuser,isInstanceAdmin,companyIds, andmembershipsfromreq.actorinstead of issuing a secondresolveBoardAccesslookup.auth-board-key-touch-timeout.test.ts, claude-local resume/immutable-thinking cases, and a cli-auth/me actor-snapshot test.Verification
pnpm --filter @paperclipai/server exec vitest run src/__tests__/cli-auth-routes.test.ts src/__tests__/auth-board-key-touch-timeout.test.ts src/__tests__/claude-local-execute.test.ts— all pass (15 + 18 active tests).Risks
55P03/"lock timeout" case (re-throws everything else), and the cli-auth/me change returns the same shape from already-resolved actor data.Model Used
Checklist