Skip to content

Branch list and switch repeatedly return HTTP 502 #274

Description

@agent-zhang-beihai

What happens

A ready schema-only branch named nickname-policy was created and switched successfully once. After switching back to the parent, branch switch nickname-policy returned 502 twice and branch list returned 502 twice over several minutes. Parent database queries still work, so the failure appears isolated to the branch management API.

Command

npx @insforge/cli branch switch nickname-policy

Error

Error: Request failed: 502

Workaround

Stopped all database writes and kept the parent project unchanged while waiting for branch API recovery.

Triage finding

Triage judged this fixable.

In src/commands/branch/list.ts and switch.ts, wrap the listBranchesApi and getProjectApiKey reads in the existing bounded transient-retry pattern (isTransientApiError from lib/errors.ts, ~3 attempts a few seconds apart, mirroring readBranchWithRetry in branch/poll.ts) and emit an actionable "control plane unreachable after N attempts" message instead of the bare Request failed: 502; verify with vitest specs in list.test.ts/switch.test.ts that mock a 502 on the first call and assert the command succeeds on retry and that a 404/403 still fails immediately without retrying.

Suggested fix

From automated triage — a starting point, not a verified plan.

In src/commands/branch/list.ts and switch.ts, wrap the listBranchesApi and getProjectApiKey reads in the existing bounded transient-retry pattern (isTransientApiError from lib/errors.ts, ~3 attempts a few seconds apart, mirroring readBranchWithRetry in branch/poll.ts) and emit an actionable "control plane unreachable after N attempts" message instead of the bare Request failed: 502; verify with vitest specs in list.test.ts/switch.test.ts that mock a 502 on the first call and assert the command succeeds on retry and that a 404/403 still fails immediately without retrying.


Component backend · severity minor · CLI 0.2.3 · win32 10.0.26200

Filed automatically from user feedback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions