Skip to content

Planner Studio: opening an existing draft clears its base branch #2932

Closed

Description

@integry

Problem

Opening an existing draft in Planner Studio (Define stage) clears the draft's base branch and saves the cleared value back:

PUT /api/planner/drafts/<id>  {"context_config":{"baseBranch":"", …}}

After that, Generate Plan, Export Context and Refresh context now stay disabled because the draft has no base branch.

Cause

In propr-ui/src/components/TaskPlanner/SetupWizard.tsx (useSetupWizardLoaders):

const repoLoader = useRepositoryLoader(true, initialRepository ?? undefined, initialBaseBranch ?? undefined);
const newModeBranches = useBranchesLoader(isNewMode ? repoLoader.selectedRepo : '', repoLoader.selectedBaseBranch, setConfig);
const repoInfo = useRepoInfoLoader(isNewMode, draft, setConfig);
  1. useRepositoryLoader(true, …) loads the repository catalog even when an existing draft is being edited.
  2. When the catalog arrives, it sets selectedBaseBranch from the catalog entry's baseBranch.
  3. That changes the dependencies of useBranchesLoader('', …), so its effect re-runs. In edit mode the repository is '', and useResolvedBaseBranch defaults to clearOnMissingRepository: true, so it calls clearResolvedBaseBranch(setConfig).
  4. useRepoInfoLoader's dependencies did not change, so it doesn't re-run, and nothing restores the draft's branch.
  5. Draft persistence then saves baseBranch: "".

On first mount the order happens to be harmless: clear, then the draft's branch is set. The bug appears only when the catalog loads afterwards, which a real server's catalog (InstanceCatalogRepository.baseBranch) triggers.

Reproduction

Found while rendering Planner Studio against mocked API responses for the site screenshots:

  1. Open a draft whose context_config.baseBranch is main.
  2. The repository catalog includes baseBranch for its repositories.
  3. Within the save debounce, the UI sends the PUT above, and Generate Plan is disabled.

It hasn't been confirmed on a live instance yet.

Suggested fix

Keep the new-mode branch resolver out of edit mode. For example:

  • pass shouldResolve: isNewMode to useBranchesLoader, or
  • set clearOnMissingRepository: false there, or
  • only run useRepositoryLoader in new mode.

Add a regression test: an existing draft with baseBranch: 'main', with the catalog resolving after mount, keeps baseBranch and sends no clearing PUT.

🤖 Generated with Claude Code

Activity

  1. propr-dev commented on Oct 10, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 2932/claude-opus-5-5-planner-studio-opening-an-20261010-2100-enh
    • Base Branch: main
    • Worktree: issue-2932-20261010-2100-claude-opus-5-5-enh

    🔍 Track Task Execution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions