Skip to content

fix(core): improve ask caller routing and cross-dir session resolution#111

Merged
bfly123 merged 1 commit intobfly123:mainfrom
daniellee2015:clean/upstream-routing-session-v2
Mar 7, 2026
Merged

fix(core): improve ask caller routing and cross-dir session resolution#111
bfly123 merged 1 commit intobfly123:mainfrom
daniellee2015:clean/upstream-routing-session-v2

Conversation

@daniellee2015
Copy link
Contributor

@daniellee2015 daniellee2015 commented Mar 4, 2026

Summary

This PR hardens async task routing and session resolution in core flows.

Problem

  1. In nested-directory and cross-pane scenarios, ask can route to the wrong caller/session
    when CCB_CALLER is missing or incomplete.
  2. Users may see processing... while the target session never actually starts work.
  3. On single-instance lock collisions, current behavior hard-fails instead of reusing the
    existing provider pane.

Files changed

  1. bin/ask
  2. bin/ccb-completion-hook
  3. ccb
  4. lib/session_utils.py

What changed

  1. bin/ask

  2. Added robust caller detection (CCB_CALLER + pane/env hints + fallback).

  3. Removed strict hard-fail when caller is missing; use controlled fallback caller.

  4. Added async observability output (task status/log file paths and lifecycle markers).

  5. Guardrail text is now strict-by-default only for Claude caller to reduce false guidance for
    other callers.

  6. bin/ccb-completion-hook

  7. Improved session file lookup and work-dir compatibility checks for nested-dir workflows.

  8. lib/session_utils.py

  9. find_project_session_file now searches upward from cwd and picks nearest valid session
    file.

  10. ccb

  11. On lock collision in single-provider mode, try to reuse/activate existing live pane
    instead of hard-failing.

  12. Explicitly inject CCB_CALLER into provider pane env to reduce caller ambiguity across
    processes.

  13. OpenCode startup path is hardened in single-provider handoff scenarios.

User impact

  1. Better routing from subdirectories.
  2. Faster diagnosis when tasks appear stuck (status/log lifecycle is visible).
  3. Fewer hard failures when an existing ccb instance is already active.

Risk

  1. Low-to-medium; mostly default routing/session resolution behavior.
  2. Changes are additive with fallbacks.
  3. No protocol-level model behavior changes.

Out of scope

  1. No ccb-status submodule updates.
  2. No ccb-multi, worktree, or context-related changes.
  3. No non-core package changes.

Validation

  1. Python syntax checks passed for all touched files.
  2. Verified nested-dir session routing behavior.
  3. Verified single-provider lock-collision pane reuse path.

@bfly123 bfly123 merged commit 1e58557 into bfly123:main Mar 7, 2026
3 of 13 checks passed
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