Skip to content

fix(session): reconcile before-agent-start ordering after default-model admission redesign #4519

Description

@Yeachan-Heo

Exact regression

Dev CI run 31736419453 at 96e8f23ea808844ea27a4dc59468bc9f111dc4fc, shard-2 job 94572361145 fails packages/coding-agent/test/agent-session-before-agent-start-attribution.test.ts after merged PR #4496 / commit e4f4281ac80dc2d7deb0ae31cbbe4e5570760308 changed setDefaultModelSelection admission ordering.

Exact failures:

  1. :224orders an accepted prompt before a later default selection through provider start: expected selection credential probe not to overtake active prompt preflight, but it now does (Expected false, Received true).
  2. orders an accepted default selection before later prompt preflight: DefaultModelSelectionRecoveryError after durable selection.
  3. :336disposal drains an active selection: queued prompt rejects with same-session AgentBusyError during dispose and escapes as unhandled error.

The same file was unchanged after #4496; the production diff explicitly moved credential probe and waitForIdle outside the selection admission. #4496 focused suites did not include this cross-contract test. This is distinct from #4518 auth-storage fixture drift and #4501 ACP cleanup classification.

Acceptance

  • Reconcile the canonical contract between prompt preflight attribution, default-model selection, and dispose.
  • Preserve fix(session): order default-model-selection admission before waitForIdle (#4471) #4496's auto-compaction deadlock fix; do not put waitForIdle back under a lease that blocks continuation prompt admission.
  • Preserve fail-fast reentrancy and missing-credential semantics where compatible with causal admission ordering.
  • Credential probing/durable mutation must not violate accepted prompt ordering or mutate a successor session.
  • Default-selection-first then prompt, prompt-first then selection, same-session reentrancy, abort, and dispose all settle deterministically without unhandled rejection or recovery error.
  • Run the exact failing file, fix(session): order default-model-selection admission before waitForIdle (#4471) #4496 default-model-selection suite, auto-compaction continuation suite, SDK host wiring, and exact shard-2.
  • One focused PR to current dev, independent exact-head adversarial review, full CI, merge, closure, and postmerge Dev CI.


[repo owner's gaebal-gajae (clawdbot) 🦞]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions