Skip to content

feat(sessions): report a re-import's new messages and its refusals - #684

Merged
ImriKochWix merged 1 commit into
mainfrom
feat/sessions-import-reimport
Oct 29, 2026
Merged

ImriKochWix merged 1 commit into
mainfrom
feat/sessions-import-reimport

Conversation

@ImriKochWix

@ImriKochWix ImriKochWix commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Note

Description

Teaches base44 sessions import about re-importing a session that already has a live Base Code branch. The server can now answer a repeat import by appending only the newer messages (reimported: true, with turn_count counting just the new ones), so the CLI reports that outcome distinctly instead of claiming a fresh import, and it translates the two new 409 refusals (session_changed, branch_busy) into plain messages an agent can relay.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • core/session-import/api.ts: added reimported to the success schema, defaulted to false so servers without re-import support still validate, and exposed it on the camelCase transform.
  • core/session-import/api.ts: mapped 409 session_changed (earlier messages no longer match — points at the branch and tells the user to pick "Import into a new branch") and 409 branch_busy (the branch is mid-turn) to plain messages, both falling back gracefully when details.branch_name is absent.
  • cli/commands/sessions/import.ts: extracted the success line into an outcome() helper covering three cases — re-import with new messages ("Added N new messages…"), re-import with nothing new ("Nothing new to import…"), and the existing fresh/continued import wording.
  • tests/cli/sessions_import.spec.ts: added a branch_busy case to the HTTP error-mapping table and a parameterized test for the two re-import success lines (3 new messages and 0).
  • docs/commands.md: documented re-import semantics and the new 409 codes.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The change is backward compatible in both directions: an older server that omits reimported still parses (the field defaults to false and the original wording is used), and unmapped error codes keep falling through to the existing generic handling. docs/commands.md also mentions 409 wrong_session (a key minted for another session's branch), which has no bespoke message here and relies on the generic error path.


🤖 Generated by Claude | 2026-10-29 13:26 UTC | c1fb02f

Base Code now appends only the newer turns when a session is imported again
into its branch (base44-dev/apper#35818). The response's `reimported` flag picks
the success line: "Added N new messages to <branch>" or "Nothing new to import".
409 `session_changed` and `branch_busy` get plain messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.2.6-pr.684.c1fb02f

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.2.6-pr.684.c1fb02f"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.2.6-pr.684.c1fb02f"
  }
}

Preview published to npm registry — try new features instantly!

@ImriKochWix
ImriKochWix merged commit 2c8a7e6 into main Oct 29, 2026
16 checks passed
@ImriKochWix
ImriKochWix deleted the feat/sessions-import-reimport branch October 29, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants