Skip to content

fix some bug - #6

Merged
vearne merged 2 commits into
mainfrom
test
May 9, 2026
Merged

fix some bug#6
vearne merged 2 commits into
mainfrom
test

Conversation

@vearne

@vearne vearne commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • OpenAI chat model configuration now supports environment variables for base URL and model selection
    • Optional Agentscope Studio service integration added to the interrupt agent example
  • Bug Fixes

    • Improved interrupt handling to ensure Studio forwarding and post-reply hooks complete properly
    • Fixed configuration initialization in Anthropic, Gemini, and OpenAI chat models

Review Change Stack

@vearne
vearne merged commit 291f080 into main May 9, 2026
1 check passed
@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8a32e8cc-1f78-4dcf-b81b-b3bb3f89b9b3

📥 Commits

Reviewing files that changed from the base of the PR and between 7471092 and e94a61c.

📒 Files selected for processing (6)
  • examples/interrupt_agent/main.go
  • pkg/agent/deep.go
  • pkg/agent/react.go
  • pkg/model/anthropic.go
  • pkg/model/gemini.go
  • pkg/model/openai.go

📝 Walkthrough

Walkthrough

This PR updates agent interrupt handling to preserve Studio forwarding and post-reply hooks by using non-cancelled contexts, initializes model config fields non-nil by default, and enhances the interrupt agent example with optional Studio integration and environment-based OpenAI configuration.

Changes

Agent Context Resilience and Model Configuration Defaults

Layer / File(s) Summary
Model Configuration Defaults
pkg/model/openai.go, pkg/model/gemini.go, pkg/model/anthropic.go
Chat model constructors now initialize config to a non-nil empty ModelConfig struct, allowing subsequent With* options to write into an already-initialized field.
Agent Context Preservation
pkg/agent/deep.go, pkg/agent/react.go
DeepAgent and ReActAgent HandleInterrupt methods use context.WithoutCancel(ctx) to derive a non-cancelled context for Studio forwarding and post-reply hooks, ensuring these operations complete even after interrupt cancellation.
Example: Studio Integration & Environment Config
examples/interrupt_agent/main.go
Example now optionally initializes and defers Studio shutdown; OpenAI model configuration reads OPENAI_BASE_URL and OPENAI_MODEL from environment variables instead of hardcoded values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • vearne/agentscope-go#4: Both PRs modify the agent interrupt/HandleInterrupt flow (deep/react agents) and Studio forwarding logic.
  • vearne/agentscope-go#1: Both PRs extend Studio integration in examples and refine agent Studio forwarding behavior.

Poem

🐰 With contexts unbroken and configs pre-set,
Our rabbits now handle the interrupt reset.
The Studio keeps pace, no message will drop,
While models stand ready, with defaults on top!
Environment whispers guide the way—
Our agents now thrive, come what may. 🌱

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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