Repository navigation
fix(work-view): run the My Work refresh on the configured provider's agent first (#5435) - #5436
Merged
Merged
Conversation
Contributor
[Medium impact] The PR appears safe to merge; it changes the first agent choice while preserving existing fallback limits. SummaryMy Work now tries the local agent named by
No actionable issues were found. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Build refresh task] --> B[Read configured provider]
B --> C[Set preferred local agent, if any]
C --> D[Detect authenticated agents with executable paths]
D --> E[Try preferred agent first, then remaining detect order]
E --> F{Run result}
F -->|Success| G[Finish]
F -->|Answer refused| H[Stop without fallback]
F -->|Run failed| I[Try next usable agent]
Reviews (2) · Last reviewed commit: "fix(work-view): run the My Work refresh ..." · Reviewed by Greptile |
Owner
|
Merged, thank you @0xABCD01! The scheduled My Work refresh now tries the agent that |
This was referenced Nov 6, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5435
Problem
The scheduled My Work refresh picked its agent by detect order alone.
detectUsableAgents()always lists Claude Code first, andrunAgentTaskran the first logged-in agent it found, so withCLAUDE_MEM_PROVIDER=codexand both tools logged in, every refresh ran on Claude Code anyway — in the reporter's case 81 of 81 scheduled runs, billed to the Claude subscription for work done in Codex. The setting governed the observer's own calls but never reached the refresh's agent selection.Fix
The configured provider now decides which agent the refresh tries first. Eligibility and fallback are unchanged.
AgentTaskgains an optionalpreferredAgent.runAgentTasktries it first when it is logged in; the other usable agents keep detect order behind it. With no preference, selection is exactly as before.buildRefreshTasksets that field from a newresolvePreferredRefreshAgent(dataDir), which readsCLAUDE_MEM_PROVIDERthe same wayresolveStepModelsreads the refresh model settings in the same file.claude→ Claude Code,codex→ Codex,gemini→ Gemini. A provider that names an API endpoint (openrouter,openai-compatible) names no local agent, so detect order decides as today. The worker builds a fresh task for every run, so a provider change applies to the next refresh.codex exec --ephemeraland used up my ChatGPT Codex quota (~230 hidden runs in 4 days, withCLAUDE_MEM_PROVIDER=claude) #5189). Hard confinement is the larger change proposed in fix(work-view): confine auto-refresh to configured provider to prevent codex fallback (#5241) #5245 for My Work auto-refresh silently falls back to codex exec --ephemeral and used up my ChatGPT Codex quota (~230 hidden runs in 4 days, with CLAUDE_MEM_PROVIDER=claude) #5241; this PR does not take that step.Tests
New tests in
tests/services/agent-runner/run.test.tsandtests/work-view/auto-refresh.test.ts:claude/codex/gemini, returns no preference for endpoint providers, keeps Claude Code first when the provider is unset, and lets the environment override the settings file. A refresh task built underCLAUDE_MEM_PROVIDER=codexcarries Codex as its preferred agent.bun test tests/services/agent-runner/ tests/work-view/: 336 pass, 0 fail.bun run typecheck:rootclean.