Skip to content

feat: Simplify API surface and improve claude streaming correctness - #2

Merged
xushiwei merged 1 commit into
goplus:mainfrom
CarlJi:feat/enhance_basic_test
Mar 3, 2026
Merged

feat: Simplify API surface and improve claude streaming correctness#2
xushiwei merged 1 commit into
goplus:mainfrom
CarlJi:feat/enhance_basic_test

Conversation

@CarlJi

@CarlJi CarlJi commented Mar 2, 2026

Copy link
Copy Markdown
Member
  • Remove premature Capabilities fields (Daemon, StructuredOutput, MultiModal, ExtendedThinking)
  • Remove ReasoningEffort type and OutputSchema from SessionConfig; drop corresponding claude CLI args
  • Fix duplicate TextEvent in claude streaming: suppress result-line text when assistant events already delivered it
  • CollectResult now returns error on fatal ErrorEvent instead of silently ignoring it
  • Rewrite demo/basic as a full multi-backend integration demo covering 8 scenarios (validate, single-turn, streaming, multi-turn, resume/fork, config override, MCP, health-check)
  • Update README: revise Executor interface docs, replace DockerExecutor section with Custom Executors, expand event table with Source/MCPServer/CallID fields

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on refining the core API by removing unnecessary capability flags and configuration parameters, leading to a cleaner and more focused interface. It also addresses a critical bug in Claude's streaming output to ensure correct event delivery and improves error handling for fatal events. A major enhancement is the complete rewrite of the basic demo, transforming it into a robust, multi-backend example that covers a wide array of interaction patterns, significantly improving the utility and clarity of the project's examples. Corresponding documentation has been updated to reflect these architectural and functional changes.

Highlights

  • API Surface Simplification: Removed several premature capability fields (Daemon, StructuredOutput, MultiModal, ExtendedThinking) from the Capabilities struct across various agent implementations, streamlining the API.
  • Configuration Cleanup: Eliminated the ReasoningEffort type and OutputSchema field from SessionConfig, along with their corresponding command-line arguments for the Claude agent, simplifying session configuration.
  • Claude Streaming Correctness: Fixed an issue in Claude streaming where TextEvents were duplicated by suppressing text from the final 'result' line if it had already been delivered via streaming 'assistant' events.
  • Enhanced Error Handling: Modified CollectResult to no longer silently ignore fatal ErrorEvents, instead returning an AgentError to ensure proper error propagation.
  • Comprehensive Demo Overhaul: Rewrote the demo/basic example into a full multi-backend integration demo, showcasing 8 different scenarios including validation, single-turn, streaming, multi-turn, session resume/fork, config override, MCP interaction, and health checks.
  • Documentation Updates: Updated README.md to reflect the revised Executor interface, introduce custom executors, and expand the event table with new Source and MCPServer fields for ToolStartEvent.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Updated the Executor interface definition to use Exec returning a Process handle instead of Run returning ExecResult.
    • Removed the DockerExecutor and E2BExecutor sections, replacing them with a more general Custom Executors section.
    • Expanded the event table to include Source and MCPServer fields for ToolStartEvent.
  • agent.go
    • Removed Daemon, StructuredOutput, MultiModal, and ExtendedThinking fields from the Capabilities struct.
  • claude/args.go
    • Removed the --output-schema and --reasoning-effort command-line arguments from the Claude agent's argument builder.
  • claude/claude.go
    • Simplified the Capabilities returned by the Claude agent, retaining only Streaming, SessionResume, and ForkSession.
  • claude/parser.go
    • Modified the mapEvent function to conditionally include a TextEvent when processing the result line, ensuring text is emitted if not already streamed by assistant events.
  • claude/session.go
    • Implemented a statefulMapLine function to prevent duplicate TextEvents during Claude streaming by suppressing text from the final result line if it was already delivered via assistant events.
  • codex/codex.go
    • Simplified the Capabilities returned by the Codex agent, retaining only Streaming and SessionResume.
  • demo/basic/main.go
    • Rewrote the demo application to support multiple backends (Claude, Codex, Gemini, OpenCode) via command-line flags.
    • Introduced a demoBackend struct to manage agent and executor instances for each backend.
    • Added runAllScenarios function to execute a comprehensive suite of 8 interaction scenarios.
    • Implemented scenarios for validation, single-turn, streaming, multi-turn, session resume/fork, config override, MCP server interaction (for Claude), and health checks.
    • Added helper functions collectTextFromPrompt, suggestedModel, and truncate.
  • gemini/gemini.go
    • Simplified the Capabilities returned by the Gemini agent, retaining only Streaming and SessionResume.
  • opencode/opencode.go
    • Simplified the Capabilities returned by the OpenCode agent, retaining only Streaming, SessionResume, and ForkSession.
  • policy.go
    • Removed the ReasoningEffort type and its associated constants.
  • session.go
    • Removed the ReasoningEffort and OutputSchema fields from the SessionConfig struct.
  • stream.go
    • Modified the CollectResult function to return an AgentError if a fatal ErrorEvent is encountered during stream processing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces significant and valuable changes. It simplifies the API surface by removing several fields from Capabilities and SessionConfig, which makes the library easier to use. The fix for duplicate TextEvent in Claude streaming is a crucial correctness improvement, and the implementation with statefulMapLine is well-reasoned. Handling fatal errors in CollectResult also enhances robustness. The complete rewrite of the demo/basic example into a comprehensive multi-backend integration test is a major improvement and will be very helpful for users. My feedback includes a few suggestions to improve error handling in the new demo code to make it even more robust. Overall, this is a great set of changes.

Comment thread demo/basic/main.go
Comment thread demo/basic/main.go
Comment thread demo/basic/main.go
Comment thread stream.go
Comment thread claude/session.go Outdated
Comment thread claude/session.go
Comment thread claude/parser.go Outdated
Comment thread demo/basic/main.go
Comment thread demo/basic/main.go
Comment thread demo/basic/main.go
Comment thread README.md
@fennoai

fennoai Bot commented Mar 2, 2026

Copy link
Copy Markdown

Good overall direction — the API surface reduction is clean and the streaming deduplication fix is well-motivated. A few things worth addressing before merge:

  • CollectText not updated: CollectResult now handles fatal ErrorEvent, but CollectText still swallows them silently, returning empty text with a nil error.
  • ToolEndEvent.ToolName always empty for Claude: the Claude tool_result message carries no name field at top-level, so ToolName will always be "" for Claude despite being documented as populated.
  • Demo model names are invalid: "claude-4.6-sonnet" and "gpt-5-codex" don't match any real model identifiers and will fail at runtime for users adapting the demo.

See inline comments for details.

- Remove premature Capabilities fields (Daemon, StructuredOutput, MultiModal, ExtendedThinking)
- Remove ReasoningEffort type and OutputSchema from SessionConfig; drop corresponding claude CLI args
- Fix duplicate TextEvent in claude streaming: suppress result-line text when assistant events already delivered it
- CollectResult now returns error on fatal ErrorEvent instead of silently ignoring it
- Rewrite demo/basic as a full multi-backend integration demo covering 8 scenarios (validate, single-turn, streaming, multi-turn, resume/fork, config override, MCP, health-check)
- Update README: revise Executor interface docs, replace DockerExecutor section with Custom Executors, expand event table with Source/MCPServer/CallID fields
@CarlJi
CarlJi force-pushed the feat/enhance_basic_test branch from ecab10f to 6a5db77 Compare March 2, 2026 12:36
@xushiwei
xushiwei merged commit e75106c into goplus:main Mar 3, 2026
4 checks passed
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.

2 participants