Skip to content

fix(server): steering, handoffs, status fetches and Codex renames behave as users expect - #462

Merged
trancong12102 merged 1 commit into
mainfrom
fix/batch-0526-shared-core
Nov 20, 2026
Merged

trancong12102 merged 1 commit into
mainfrom
fix/batch-0526-shared-core

Conversation

@trancong12102

@trancong12102 trancong12102 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Shared-core follow-ups queued by the upstream syncs (batch 0526, P2 shared core / Claude / Codex).

Problem

Several shared paths behaved differently from what the user sees:

  • A queued message could start ahead of an unread steer.
  • Handoffs, usage-limit resume and provider switches picked up scheduled fresh-session runs as if they were the conversation.
  • Detach left a busy marker that blocked idle release.
  • The background status fetch backed off on every sealed refusal, even when the remote had simply moved since the dry run.
  • Agent messages starting with a path or $VAR lost their sender note.
  • Codex kept retrying a session rename after method-not-found.
  • Storage cleanup could delete a worktree mid cherry-pick.
  • A handful of smaller leaks in the shared core.

Fix

  • Checkpoint capture. It commits the run's end under the thread's dispatch lock and re-reads the run inside the lock. A dispatch that saw the run active acts before the run ends.
  • Main-conversation handoffs. Recovery, steer handoff, provider switch and portable fork take their runs from the conversation's own provider thread, so scheduled fresh-session runs stay out; side chats keep them. The same applies to usage-limit auto-resume, the provider switch source run, "Compact and send", and the idle compaction staleness check.
  • Remote follow-up wakes name the remote thread and environment.
  • Detach clears the stopped turn's busy marker.
  • Model scans. orchestrator_capabilities and model retries scan only providers whose folder config can list models.
  • Remote tail probe. It keeps paging from the tail.
  • Sealed status fetch. One refusal right after a good dry run is treated as the remote moving on; two in a row back off. A failed dry run clears the mark, and the mark set is capped. Repositories without alternates skip count-objects.
  • Sender note. It is skipped only for real leading slash commands and $skill tokens. The grammar follows the composer: no $25k, $1e3, $HOME, $_x.
  • Smaller fixes:
    • Codex stops renaming a session after method-not-found.
    • Storage cleanup keeps worktrees with a paused cherry-pick, revert or merge.
    • Mobile goal commands keep the thread's interaction mode.
    • PR file ordering is heap-based instead of quadratic.

The "Claude cancels it twice" unread-steer integration test waits for the next run's starting event before draining. The run-end reaction starts that run outside the effect worker. Committing the run end under the lock let drain() return before the start was enqueued, and CI timed out there.

Every new test was checked to fail on its base and pass with the fix. vp run check:changed passes.

Council review

Round 1: Codex gpt-6.2-astra (high) and Claude Opus.

  • Both: force-stop unload race. Unloading the provider thread on force stop raced a follow-up that was reusing the process. Reverted the unload; behaviour is as on main. Queued as a follow-up with the race analysis.
  • Codex: handoff after a scheduled fresh run. The provider switch still used the global latest run as its anchor. Fixed: the anchor is now the conversation's latest run, with integration tests for the immediate and queued paths.
  • Codex: sealed-fetch refusals. Round 1 swallowed every refusal, so a persistent fault never backed off. Fixed: a second refusal in a row fails, with a test using a stale ref lock.
  • Opus: sender-note grammar was too loose. Fixed to follow the composer grammar, with table rows.
  • Opus: ChatView compact-offer ordering. Fixed: the schedule check runs after the resume-compaction check.

Round 2 (only what changed):

  • Codex. The handoff runs are now computed lazily in both Orchestrator paths. The amount and first-character rules follow the composer. The refusal set is capped. All fixed.
  • Opus: refusal mark survived an unrelated dry-run failure. Fixed by clearing the mark on a failed dry run.
  • Opus: missing rows. Added rows for an uppercase slash command and $MY_VAR.
  • Opus: accepted residuals.
    • Two-segment paths such as /tmp/x or /Users/me crashes still read as a slash command and skip the note. Only the label is lost; skills still dispatch.
    • All-caps $ABC is treated as an environment variable, not a skill.
    • The legacy v1-import latestCompletedRun still reads all runs. This only matters for a v1-imported thread whose only completed run was a scheduled fresh run.

Not fixed here (queued)

  • Steering restart vs finalization can strand a run, because the checkpoint effect id is per run. Pre-existing.
  • Force-stop leaves the native turn running in a process kept for a follow-up. Same as on main, since the unload was reverted.
  • Compact offer when the prompt falls outside the loaded window needs a run-level schedule marker.
  • Capabilities no-op scans.
  • Manual usage-limit continuation guard was not added.

Rejected

  • Theme escaped quotes: already fixed on main by 715f8c0.
  • "Two scenarios leave server settings behind": already fixed by 859a22e in the sync PR.

Model and harness: Claude Opus 5.5 in Claude Code (Onicode), with Codex gpt-6.2-astra and Claude Opus reviewers.

🤖 Generated with Claude Code

…ave as users expect

Shared-core follow-ups from the upstream sync and batch 0035 reviews:

- Checkpoint capture commits a run's end under the thread's dispatch lock,
  so a queued message can no longer start ahead of an unread steer.
- Main-conversation handoffs (recovery, steer handoff, provider switch,
  portable fork) leave scheduled fresh-session runs out; side chats keep
  them. Usage-limit auto-resume skips a run whose session is not the
  conversation's, and provider switches take their source run from the
  same conversation. Remote follow-up wakes name the remote thread and
  environment. "Compact and send" ignores a scheduled session's usage.
  Idle compaction drops a dispatch whose measured session or selection
  moved on.
- Detach clears the stopped turn's busy marker so idle release can run.
- orchestrator_capabilities and model retries scan only providers whose
  folder config can list models. The remote result tail probe keeps
  paging from the tail instead of restarting.
- A single sealed status fetch refusal (the remote moved since the dry
  run) no longer backs off; two in a row still do. Repositories without
  alternates skip count-objects.
- Agent messages starting with a path or $VAR keep their sender note.
  Codex stops renaming a session after method-not-found. Storage cleanup
  keeps worktrees with a paused cherry-pick, revert or merge on their
  branch. Mobile goal commands keep the thread's interaction mode. PR file
  ordering is linear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trancong12102
trancong12102 force-pushed the fix/batch-0526-shared-core branch from c311179 to deb2d22 Compare November 20, 2026 00:24
@trancong12102
trancong12102 merged commit 3b1944f into main Nov 20, 2026
18 checks passed
@trancong12102
trancong12102 deleted the fix/batch-0526-shared-core branch November 20, 2026 00:38
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.

1 participant