Skip to content

🤖 fix: keep agent accents stable on workspace switch#2632

Open
ammar-agent wants to merge 2 commits intomainfrom
agent-switcher-cvp1
Open

🤖 fix: keep agent accents stable on workspace switch#2632
ammar-agent wants to merge 2 commits intomainfrom
agent-switcher-cvp1

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Feb 25, 2026

Summary

Builds on the upstream agent-switcher fixes now in main by adding robust cache hydration rules and shared accent fallback resolution, so workspace switching stays visually stable without introducing invalid cross-scope agent selection.

Background

A coworker commit landed on main during review (#2635: auto-cycle exclusion + initial color flash fixes). This branch was rebased/reconciled on top of that work. Remaining gaps were around cache hydration semantics (workspace/project scope leakage) and consistent fallback accents while metadata is pending.

Implementation

  • Rebased onto latest main and reconciled overlap with #2635.
  • Added a two-tier in-memory cache in AgentContext keyed by:
    • workspace + project + workspace-agent-mode (enabled / disabled)
    • project + workspace-agent-mode (enabled / disabled)
  • On scope change, AgentContext hydrates optimistically from workspace cache first, then project cache, before background refresh.
  • Added project-cache source metadata (project vs workspace) and tightened hydration rules:
    • project-scoped providers do not hydrate from workspace-sourced project cache entries
    • workspace scope treats workspace-sourced project fallback as display-only (non-selectable)
    • project-sourced fallback remains selectable in workspace scope
  • Scoped workspace cache keys by project path to avoid cross-project collisions when workspace IDs are reused.
  • Added resolveAgentAccentColor(agentId, discoveredUiColor?) in src/browser/utils/agents.ts with built-in fallbacks for ask, plan, exec, orchestrator, and auto.
  • Updated AgentModePicker trigger border/icon and ChatInput focus border to use shared accent resolution.
  • Kept cycle behavior aligned with current mainline intent:
    • never cycle into Auto
    • still allow cycling out of Auto even when only one manual agent remains
  • Added regression tests for:
    • workspace cache hydration on revisit
    • sibling-workspace project fallback behavior
    • workspace-cache isolation across projects sharing the same workspace ID
    • project-scope isolation from workspace-sourced cache entries
    • project-sourced fallback remaining selectable in workspace scope
    • cycle shortcut exiting Auto with only one manual agent available
    • trigger border/icon color sync and built-in accent fallbacks (including orchestrator)

Validation

  • bun test src/browser/contexts/AgentContext.test.tsx
  • bun test src/browser/components/AgentModePicker.test.tsx
  • bun x eslint src/browser/contexts/AgentContext.tsx src/browser/components/AgentModePicker.tsx src/browser/components/ChatInput/index.tsx src/browser/utils/agents.ts src/browser/contexts/AgentContext.test.tsx src/browser/components/AgentModePicker.test.tsx
  • make static-check

Risks

Low-to-moderate UX risk: optimistic project fallback can still be briefly stale across sibling workspaces with divergent custom agents, but fallback visibility/selectability is now scope-aware and live fetch remains authoritative.


Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $1.07

@ammar-agent
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Updated the agent switcher trigger to restore the compact icon while keeping icon/border colors sourced from the same accent value to prevent loading desync.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent ammar-agent changed the title 🤖 fix: remove trigger icon flicker in agent switcher 🤖 fix: keep agent accents stable on workspace switch Feb 25, 2026
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 592ff889f0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

1 similar comment
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b924ac1262

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91f9e2c6cb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Rebased on latest main and reconciled with recent agent-picker changes.

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34ee509383

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1415bba3d6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 457d80148b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Rebased onto latest main (which already included #2635), reconciled overlap, and kept only additional cache/accent/test coverage.

@ammar-agent
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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