Skip to content

fix: prevent hang when plugin calls client.app.log() during init#68

Closed
kdcokenny wants to merge 125 commits intokevint-cerebras:devfrom
kdcokenny:fix/plugin-init-hang
Closed

fix: prevent hang when plugin calls client.app.log() during init#68
kdcokenny wants to merge 125 commits intokevint-cerebras:devfrom
kdcokenny:fix/plugin-init-hang

Conversation

@kdcokenny
Copy link

@kdcokenny kdcokenny commented Feb 3, 2026

Background

Ported from upstream anomalyco/opencode#11642 (merged Feb 1, 2026).

The Bug

Severity: CRITICAL (blocking - prevents OpenCode from starting)

When a plugin calls client.app.log() during its initialization phase, OpenCode hangs forever and never starts.

Root Cause: Circular dependency during startup:

client.app.log() 
  → server /log route 
  → Instance.provide middleware 
  → InstanceBootstrap 
  → Plugin.init 
  → your plugin 
  → client.app.log() 
  → INFINITE LOOP

The Fix

Skip the Instance.provide middleware for the /log endpoint to break the circular dependency.

File: packages/opencode/src/server/server.ts

.use(async (c, next) => {
  // Skip Instance.provide for /log to prevent circular dependency
  if (c.req.path === "/log") return next()
  
  // ... rest of middleware unchanged
})

kevint-cerebras and others added 30 commits December 8, 2025 19:06
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add collaborators section to README
This reverts commit b72735c.

Restores multi-provider support and removes Cerebras OAuth login.
…otifs

notification system with toast, fullscreen, banner
kevint-cerebras and others added 22 commits January 27, 2026 13:57
…mit-bars-on-successful-req

only show limit bars when successful request is made
Adds a new skill that leverages Cerebras's blazing-fast inference for
rapid prototyping workflows. This skill guides users through iterative
development cycles that take full advantage of Cerebras's speed.

Key features:
- Structured prototyping workflow (sketch → iterate → refine)
- Multiple-approach exploration strategies
- Fast feedback loop patterns
- Parallel experimentation techniques

This is specifically valuable for Cerebras Code CLI because the
millisecond inference times make iteration cycles extremely cheap,
enabling developers to try more approaches in less time.

Amp-Thread-ID: https://ampcode.com/threads/T-019c0472-e495-7701-84f7-e6ab43f44d9c
Co-authored-by: Amp <amp@ampcode.com>
Replace fixed retry schedule with exponential backoff + jitter that
retries until the next hour boundary when rate limits reset.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Specification, Pseudocode, Architecture, Refinement, Completion —
a thinking-before-coding workflow that pairs well with fast inference.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add .cerebras as the primary config directory/file name while keeping
.opencode as a fallback. Add CEREBRAS_CODE_* env var aliases for all
OPENCODE_* flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Import types directly from @ai-sdk/provider-utils and @ai-sdk/provider
  to avoid namespace interpretation issues in tsgo
- Add explicit type annotations to callback parameters
- Fix z.record() calls for Zod 4 (requires key + value schemas)
- Use type assertions where type guards don't narrow correctly
- Add @ts-expect-error for runtime-only properties in @OpenTui

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix the off-by-3 bug in some of the command options.
…ed-prototyping-skill

feat: Add speed-prototyping skill
core: smarter retry backoff for Cerebras rate limits
When user skips Cerebras onboarding, show 'Not configured' instead of 'Loading...' to prevent indefinite hang.
fix(tui): Fixes infinite "Loading..." if Cerebras API key config is skipped
Change Priority of Cerebras Provider
Skip Instance.provide middleware for /log endpoint to break circular
dependency: plugin init → client.app.log() → /log route → Instance.provide
→ InstanceBootstrap → plugin init → infinite loop

Ported from upstream PR #11642
@kdcokenny kdcokenny marked this pull request as ready for review February 3, 2026 13:23
@kevint-cerebras kevint-cerebras force-pushed the dev branch 4 times, most recently from c0e8f40 to b576ddb Compare February 13, 2026 00:41
@kevint-cerebras
Copy link
Owner

thanks for the PR! Looks like a lot of changes got wrapped up in this. I'm going to just commit the last push you made. Thanks again!

@kevint-cerebras
Copy link
Owner

ah, looks like its already been merged

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.

9 participants