Skip to content

feat(tui): add unified task state color convention with icons#5

Open
herjarsa wants to merge 84 commits intodevfrom
feat/status-color-convention
Open

feat(tui): add unified task state color convention with icons#5
herjarsa wants to merge 84 commits intodevfrom
feat/status-color-convention

Conversation

@herjarsa
Copy link
Copy Markdown
Owner

Issue for this PR

Closes anomalyco#10287

Type of change

  • New feature

What does this PR do?

Adds automatic model fallback chain when the primary model fails after all retries are exhausted.

When a model encounters an error that retries cannot resolve, the processor now checks if a fallbackModels chain was configured (e.g. via fallback_model in agent config). If so, it resolves the next model in the chain and re-attempts the stream with that model.

Error classification for fallback:

  • Fallback triggered: retryable APIError (rate limits, 5xx, transient errors)
  • No fallback: AuthError (bad credentials), AbortedError (user cancelled), non-retryable APIError (permanent failures), ContextOverflowError (triggers compaction instead)

Implementation details:

  • Added fallbackModels field to MessageV2.User schema
  • Added resolveFallbackChain helper to Provider service (returns {model, remaining})
  • Added outer while loop in SessionProcessor.process() to iterate through fallback models
  • Modified halt() to classify errors and set ctx.shouldFallback flag when appropriate
  • Reset error state when switching to a fallback model

How did you verify your code works?

  • bun typecheck passes with zero errors in modified files
  • Added integration tests in test/session/fallback.test.ts:
    • Auth error (401) → returns "stop" without fallback
    • Non-retryable error (400) → returns "stop" without fallback

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

davidprokopec and others added 30 commits March 25, 2026 14:07
thdxr and others added 30 commits April 25, 2026 15:08
Moves effect logging, observability, runtime utilities, flags, installation
version info, and process utilities from opencode to core package. This
enables better code sharing across packages and establishes core as the
single source of truth for foundational utilities.

All internal imports updated to use @opencode-ai/core paths for consistency.
…nagement

Move the Global module from packages/opencode/src/global to packages/core/src/global
to provide a unified location for managing XDG directories and application paths.
This eliminates duplicate path definitions across packages and ensures consistent
access to data, config, cache, state, log, and bin directories throughout the codebase.
Moved the cross-spawn-spawner module from packages/opencode to packages/core
to enable code sharing across the monorepo. This consolidates the process
spawning infrastructure into the core package so other packages can use
cross-platform child process spawning without duplicating the implementation.

Updated all import statements across the codebase to reference the new
location (@opencode-ai/core/effect/cross-spawn-spawner). Removed the
local copy from the opencode package along with its tests.
The cross-spawn-spawner module has been moved from src/effect/ to src/
to simplify the core package structure. The src/types.d.ts file which
contained unused type declarations has also been removed. All imports
throughout the codebase have been updated to reflect the new location.

This change reduces the package's internal complexity by flattening the
module hierarchy and removing dead code, making future maintenance easier.
- Add STATUS_COLORS constant with 6 states: running, waiting, attention, error, done, idle
- Each state includes color (ISO 3864 based), icon, and text for WCAG 1.4.1 compliance
- Add StatusIndicator, ProjectStatusBadge, SessionStateBanner components
- Update ToastShow event to include projectName for multi-project notifications
- Update Toast component to display project name and use status colors

Closes anomalyco#24404
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.

Critical bug revert undo messages