Skip to content

fix(work-view): run the My Work refresh on the configured provider's agent first (#5435) - #5436

Merged
thedotmack merged 1 commit into
thedotmack:mainfrom
0xABCD01:fix/5435-provider-refresh
Nov 6, 2026
Merged

thedotmack merged 1 commit into
thedotmack:mainfrom
0xABCD01:fix/5435-provider-refresh

Conversation

@0xABCD01

@0xABCD01 0xABCD01 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #5435

Problem

The scheduled My Work refresh picked its agent by detect order alone. detectUsableAgents() always lists Claude Code first, and runAgentTask ran the first logged-in agent it found, so with CLAUDE_MEM_PROVIDER=codex and 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.

Tests

New tests in tests/services/agent-runner/run.test.ts and tests/work-view/auto-refresh.test.ts:

  • A task naming Codex as preferred runs on Codex first with Claude Code also logged in. On main this test fails: Claude Code is attempted first, which is the reported bug.
  • A preferred agent that is not logged in leaves detect order in charge; a preferred agent whose run fails falls through to the next agent in detect order; a refused answer on the preferred agent is not handed to another agent.
  • The resolver maps 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 under CLAUDE_MEM_PROVIDER=codex carries Codex as its preferred agent.

bun test tests/services/agent-runner/ tests/work-view/: 336 pass, 0 fail. bun run typecheck:root clean.

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; it changes the first agent choice while preserving existing fallback limits.

Summary

My Work now tries the local agent named by CLAUDE_MEM_PROVIDER first.

  • My Work refreshes try the configured local agent first.

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]
Loading

Reviews (2) · Last reviewed commit: "fix(work-view): run the My Work refresh ..." · Reviewed by Greptile

@thedotmack
thedotmack merged commit d1829d4 into thedotmack:main Nov 6, 2026
14 checks passed
@thedotmack

Copy link
Copy Markdown
Owner

Merged, thank you @0xABCD01! The scheduled My Work refresh now tries the agent that CLAUDE_MEM_PROVIDER names first (codex → Codex, gemini → Gemini, claude → Claude Code), so Codex-only users stop spending their Claude subscription on refreshes. Eligibility and fallback are unchanged, and the test that fails on main pins the reported case. Fixes #5435. It's on main and ships in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants