Repository navigation
refactor: split agent runner execution and preserve probe state - #108137
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ff37ce82f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| if (authoritativeEntry) { | ||
| if (sessionEntryMatchesSnapshot(currentEntry, activeSessionEntryBeforeUpdate)) { | ||
| params.activeSessionStore[params.sessionKey] = authoritativeEntry; |
There was a problem hiding this comment.
Update the live session snapshot after clearing probes
When a recovered primary probe is cleared from persisted storage, this branch replaces only activeSessionStore[sessionKey]; the caller in agent-runner.ts:1862 still prefers its closed-over activeSessionEntry for fallback bookkeeping and then writes that object back to the store at agent-runner.ts:1887. In runs with an existing persisted auto-fallback entry (especially one with fallback notice fields), the stale in-memory entry can therefore resurrect the auto fallback for the rest of the process even though the database row was cleared; the old inline code mutated the same object, so the caller saw the cleared state. Please either mutate/adopt into the active entry object or return the authoritative entry so the caller can update activeSessionEntry too.
Useful? React with 👍 / 👎.
e84c996 to
73c2e23
Compare
|
Merged via squash.
|
…claw#108137) * refactor(auto-reply): split agent runner execution * fix(auto-reply): preserve concurrent probe selection * fix(auto-reply): refresh rejected probe cache * fix(auto-reply): preserve probe cache updates * fix(auto-reply): preserve concurrent probe cache state * fix(auto-reply): guard persisted probe generation * fix(auto-reply): snapshot nested probe cache state * fix(auto-reply): merge probe cleanup cache updates * fix(auto-reply): privatize fallback cycle types
…claw#108137) * refactor(auto-reply): split agent runner execution * fix(auto-reply): preserve concurrent probe selection * fix(auto-reply): refresh rejected probe cache * fix(auto-reply): preserve probe cache updates * fix(auto-reply): preserve concurrent probe cache state * fix(auto-reply): guard persisted probe generation * fix(auto-reply): snapshot nested probe cache state * fix(auto-reply): merge probe cleanup cache updates * fix(auto-reply): privatize fallback cycle types
…claw#108137) * refactor(auto-reply): split agent runner execution * fix(auto-reply): preserve concurrent probe selection * fix(auto-reply): refresh rejected probe cache * fix(auto-reply): preserve probe cache updates * fix(auto-reply): preserve concurrent probe cache state * fix(auto-reply): guard persisted probe generation * fix(auto-reply): snapshot nested probe cache state * fix(auto-reply): merge probe cleanup cache updates * fix(auto-reply): privatize fallback cycle types
What Problem This Solves
Resolves a maintenance problem where the agent-runner execution path and its test coverage had grown into large monolithic files, making ownership and regression review difficult. Also fixes recovered-primary probe cleanup races that could overwrite a newer persisted or cached model/auth selection.
Why This Change Was Made
Splits execution, fallback candidate selection, settlement, shared types, and thematic tests into focused owner modules while keeping one canonical runtime path. Probe cleanup now compares persisted generations, guards cache replacements, deep-snapshots mutable session state, and uses the canonical session snapshot merger for unrelated concurrent updates.
User Impact
Agent behavior remains equivalent for normal runs. When a primary model recovers during concurrent session updates, newer model/auth selections and nested session state are preserved instead of being replaced by stale probe cleanup.
Evidence
git diff --checkpassed.