Repository navigation
feat(sessions): send an Idempotency-Key on the session upload - #682
Merged
Merged
Conversation
The upload endpoint takes an optional Idempotency-Key (the API standard for a public POST): a retry with the same key and file gets the first response back instead of creating a second branch. Each run makes one key, shared by any retry within it, and sends it on both the import-key and the logged-in request. 409 idempotency_key_in_use says the first upload is still running; idempotency_key_mismatch keeps the server's words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.2.3-pr.682.9217d4bPrefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.2.3-pr.682.9217d4b"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.2.3-pr.682.9217d4b"
}
}
Preview published to npm registry — try new features instantly! |
netanelgilad
approved these changes
Oct 28, 2026
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.
Note
Description
Follow-up to #679: the session upload (
POST /api/apps/{app_id}/imported/session-imports) now sends anIdempotency-Keyheader, which the backend accepts per the API standard for public POSTs (base44-dev/apper#34732).uploadSessionmints onerandomUUID()perbase44 sessions importrun, before any attempt, so a retry within the run gets the first response back instead of creating a second Base Code branch. The new 409idempotency_key_in_usecode is mapped to a plain, agent-relayable message.Related Issue
Follow-up to #679 (review comment). Backend counterpart: base44-dev/apper#34732.
Type of Change
Changes Made
core/session-import/api.ts: generate onerandomUUID()per run inuploadSessionand send it asIdempotency-Keyon both auth paths — the barekycall that uses ab44imp_import key and thegetAppClient()call that uses the stored login.core/session-import/api.ts:messageFormaps 409idempotency_key_in_useto "An import of this session is still running. Wait a moment and try again." (idempotency_key_mismatchdeliberately keeps the server message — it cannot happen with one key per run.)tests/cli/sessions_import.spec.ts: the upload mock now records theidempotency-keyrequest header; a new test asserts both runs send a UUID and that the two keys differ;idempotency_key_in_useis added to the error-message table.docs/commands.md: newIdempotency-Keybullet undersessions import.CHANGELOG.md: the unreleasedsessions importentry notes that each upload carries anIdempotency-Key, so a retry never creates a second branch.Testing
npm test)Checklist
docs/(AGENTS.md) if I made architectural changesAdditional Notes
The key is created once per run rather than per attempt — that is what makes a retry idempotent — and is never reused across runs, so a deliberate second
sessions importstill creates its own branch. The header is additive: an older backend that ignores it behaves exactly as before. The PR's own test plan reports 29 passing tests plusbun run lint,typecheckandknip; that run was not reproduced in this environment.🤖 Generated by Claude | 2026-10-28 12:13 UTC | f59ec4e