GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [FEATURE]: OpenCode Benchmark Results: Strengths, Weaknesses & Recommendations · Issue #64084 · anomalyco/opencode Not planned Not planned Copy link Labels area/coreAgent loop, tools and configtype/featureNew behaviour or an improvementversion/v2OpenCode 2.x DescriptionFeature hasn't been suggested before.
Describe the enhancement you want to requestIndependent Java 25 Benchmark — OpenCode V2 Results, Weaknesses, and Engineering Quality Roadmap
Executive summaryOpenCode V2 ranked #2 overall in our provisional four-way Java 25 TableNotifier evaluation. Its original submission passed 11/14 independent source-derived behavioral checks, compared with 13/14 for Command Code and 9/14 for DSH. A fourth entry, AIR (Codex), was assessed using a different, expanded 22-case suite, so its 15/22 result must not be compared numerically with the original 14-case scores. OpenCode delivered the smallest production implementation by total lines, strong Spring integration coverage, a sensible two-module structure, and good concurrency behavior. Its remaining issues were not basic coding mistakes. They were subtle correctness-contract gaps that survived planning, implementation, and review, especially in Spring's Priority: improve correctness of delivered behavior first; preserve code efficiency and the pleasant interactive OpenCode experience. 1. What the benchmark tested (brief)All participants were asked to implement a small, production-quality Java 25 TableNotifier library:
Independent evaluation: original DSH/OpenCode/Command Code submissions were inspected and exercised with the same 14 source-derived Java behavioral checks, including concurrency, error recovery, Spring transaction edge cases, and ownership. These checks used controlled stand-ins and Java 21 because an equivalent Java 25/Gradle/dependency environment was unavailable to the independent evaluator. They are stronger than reviewing the generated tests alone but are not full integration tests against the actual Spring, jnats, and Micrometer dependencies. The participants used differing models, prompts, review workflows, and (for AIR) engineering rules. Consequently this is a comparison of observed submitted solutions, not a controlled experiment isolating the OpenCode harness from model quality or user instructions. 2. Overall ranking (brief)
Other qualitative positions for OpenCode: #2 in overall delivered correctness, #3 in compact/readable code, #4 in architecture/cohesion, #3 in effectiveness of submitted tests, and #2 in practical planning quality. These ranks are expert judgments with limited sample size—not universal rankings of coding tools. No submission was approved for unconditional production rollout. The strict dispatcher-initialization scenario was missed by all three original submissions (and AIR in its separate suite). 3. What OpenCode did particularly well
These strengths should be preserved while fixing the issues below. A larger framework or more agent orchestration is not inherently an improvement. 4. Detailed weaknesses and recommendationsP0 — A notification can be silently discarded during Spring
|
| Priority | Improvement | Suggested mechanism | How maintainers can measure success |
|---|---|---|---|
| P0 | Independent correctness review | Optional review pass that re-reads original requirements and invents negative tests, without inheriting plan exclusions | Catches the late-afterCommit fixture before completion |
| P0 | Invariant-driven acceptance | Small requirement → invariant → test matrix for critical operations |
Every critical invariant has an executed test; no claim of coverage from test count alone |
| P1 | Java transaction/lifecycle hardening | Targeted reviewer checklist for Spring commit/rollback, nested callbacks, cleanup, context inheritance, rejected execution | Fewer independent failure-injection regressions across repeat runs |
| P1 | Architecture/cohesion review | Challenge large classes that combine state machines with transport and lifecycle; refactor only when simpler | Lower complexity without increasing defect rate or line count needlessly |
| P1 | Executable adversarial probes | Facilitate fast deterministic injected-failure and race tests, plus tests against real dependencies when available | Same shared suite passes on clean checkout; failures reproducible from a script |
| P2 | Efficient parallel exploration | Use existing Explore/subagent facilities selectively; pass concise source references and constraints | Less redundant source rereading, fewer tokens, no loss in accuracy |
| P2 | Evidence-backed finish criteria | Final answer separates executed checks, unexecuted integration requirements, known limitations, and confidence level | No unsupported “production-ready” assertion |
| P2 | Benchmark telemetry | Log actual wall time, provider/model, tokens/cost if available, tools, review cycles, and fixes | Compare correctness and time/cost across identical tasks |
Stage 1 — Correctness regression: preserve the original four-way benchmark prompt and all original submissions. Add the late-afterCommit fixture and thread-context-isolation test as independently owned acceptance tests. Re-run the original 14 common cases for all participants, unchanged.
Stage 2 — Review policy: introduce a lightweight, opt-in adversarial correctness review for Java concurrency, transactions, and resource-lifecycle work. The reviewer must challenge both code and plan, not merely certify that the plan was implemented.
Stage 3 — Quality/efficiency experiment: run multiple identical task attempts with controlled models, identical AGENTS.md/tool access, and fresh workspaces. Compare correctness, unresolved defects, actual execution time, cost, test mutation detection, and source complexity. A change is worthwhile only if measurable quality gains justify its latency and token overhead.
Stage 4 — Production-grade verification: verify against real Java 25, Spring transaction managers, jnats reconnection, JFR/load, and a real database driver. Preserve the default fast test loop without Docker/network requirements.
The OpenCode-generated TableNotifier can be considered corrected against the findings in this report when:
afterCommit registrations cannot silently drop distinct table notifications.InheritableThreadLocal state.For OpenCode itself, success means the same class of failures becomes less likely in repeatable, controlled benchmarks, with documented overhead. One corrected generated library does not by itself establish that the underlying harness improved.
Artifacts examined: the submitted OpenCode production source, its docs/PLAN.md, docs/TEST_PLAN.md, docs/FINAL_REPORT.md, docs/PRODUCTION_READINESS.md, and the independent three-way and four-way audit reports.
Independent common-suite results: OpenCode 11/14, Command Code 13/14, DSH 9/14. All three passed the concurrency stress checks. AIR's separate 15/22 checks were not an identical suite.
Directly confirmed OpenCode issues: loss of late-afterCommit notifications, inherited thread-local state, and failure of a strict fallback-only startup test. Other warnings—external call under a lifecycle lock, fleet capacity, and missing production integrations—are follow-up risks or validation gaps, not proven defects.
Constraints: The independent evaluator did not run the original Java 25 Gradle/JUnit suites or live-broker suites using their real dependencies. The source-derived Java 21 tests employed controlled stand-ins. The participant's own reported test results are useful context but not independent proof.
Final assessment: OpenCode V2 is a credible #2 in this benchmark, with especially good engineering efficiency and broad test construction. The highest-value improvement is stronger independent semantic verification of original requirements, not longer plans, a larger agent graph, or more generated tests.
You are a team of two AI agents:
Your work will be independently evaluated by another AI architect using additional tests that are not available to you.
Goal: Build a small, production-quality Java library that replaces wasteful database polling with NATS Core change notifications while preserving periodic polling as a reliability fallback.
Prioritize correctness, simplicity, low resource consumption and maintainability. Do not overengineer.
Required:
io.nats:jnats)spring-tx).properties configuration where configuration is neededUse modern Java features when appropriate.
No Spring Boot dependency, Docker, embedded NATS broker, external database, Netty, JetStream or additional messaging framework.
The library must work in Spring Boot applications and also be usable without Spring.
Applications already maintain their own NATS connections.
TableNotifier must accept io.nats.client.Connection as a constructor argument.
It must:
Accept a Micrometer MeterRegistry through constructor injection. Do not create a global metric registry.
Subject format:
TableNotifier.<database>.<schema>.<table>
Example:
TableNotifier.Gate.dbo.ApplicationProperties
The Java API accepts table names without the TableNotifier. prefix.
Example:
Gate.dbo.ApplicationProperties
Requirements:
TableNotifier.A notification indicates that the corresponding database table may have changed. It is not a database event containing changed rows.
Design a small, clean API supporting operations equivalent to:
TableNotifier notifier = ...; // Subscribe and start polling var subscription = notifier.subscribe( "Gate.dbo.ApplicationProperties", this::pollDatabase ); // Publish a change notification notifier.notifyChanged( "Gate.dbo.ApplicationProperties" ); // Publish after successful Spring transaction commit notifier.notifyAfterCommit( "Gate.dbo.ApplicationProperties" ); // Remove one subscription subscription.close();
The precise interfaces and implementation classes are Terra's responsibility.
Requirements:
AutoCloseable lifecycle contracts.Applications register TableNotifier as a singleton @Bean and inject it into their DAOs.
A typical application already exposes:
@Bean Connection natsConnection() { // Existing application configuration }
TableNotifier must use that existing bean.
The planner must supply a working example of a TableNotifier Spring bean and DAO integration.
Transaction behavior:
Keep Spring integration isolated from the core NATS implementation. Prefer a small optional Spring adapter or decorator.
Do not rely on Spring Boot autoconfiguration.
Every subscription must perform database polling through its supplied callback.
Rules:
Allow polling interval and debounce delay to be configured. Use 20 seconds as the default fallback interval.
Optional: add a small configurable jitter to reduce simultaneous database queries across application instances.
Do not assume an unlimited number of notifications can be buffered.
Core NATS is at-most-once and does not persist notifications.
The library must remain useful when:
The database remains the source of truth.
A notification failure must not invalidate an already committed database transaction.
Do not introduce JetStream, persistent queues or distributed coordination.
Implement appropriate metrics using the provided MeterRegistry.
Include at least:
| Metric | Type | Purpose |
|---|---|---|
table_notifier_published_total |
Counter | Successful local publish calls |
table_notifier_publish_errors_total |
Counter | Failed publish attempts |
table_notifier_received_total |
Counter | Received notifications |
table_notifier_polls_total |
Counter | Poll executions by reason |
table_notifier_poll_duration |
Timer | Poll execution latency |
table_notifier_poll_errors_total |
Counter | Poll callback failures |
table_notifier_active_subscriptions |
Gauge | Current listener count |
table_notifier_coalesced_total |
Counter | Notifications collapsed into pending work |
Use bounded, low-cardinality tags such as reason=notification|fallback|initial.
Avoid unbounded tags containing arbitrary table names, connection addresses, user IDs or exception messages.
Avoid unnecessary per-event allocations and duplicate timers/counters.
Do not close the caller-provided MeterRegistry.
Document the semantics of each metric.
Mandatory: Provide docs/MANUAL_NOTIFICATIONS.md.
Our DevOps engineers sometimes modify database tables manually through SQL.
They must be able to notify applications afterward using the official NATS CLI.
The documentation must include:
Gate.dbo.ApplicationProperties.The documented CLI notification must be compatible with the Java subscriber without requiring a custom payload format.
Implement a small send_notification.py using the official Python NATS client.
Example interface:
python send_notification.py Gate.dbo.ApplicationProperties
It should support external NATS connection configuration and proper error handling.
This Python utility is optional. It must not delay completion of the Java implementation.
Use JUnit 5 and Google Truth.
Write deterministic, meaningful tests.
Mandatory scenarios:
Use controlled clocks, executors, latches or other deterministic techniques where practical.
Tests must not require Docker, a running corporate NATS server or access to a real database.
An optional separate integration-test suite against a local NATS server is welcome.
Do not modify tests just to hide production defects.
Prefer proven library APIs to handwritten infrastructure.
First inspect the workspace and verify the relevant library APIs and compatibility.
Create:
docs/PLAN.md — architecture, modules, public API, concurrency model, lifecycle and error handling.docs/TEST_PLAN.md — tests, invariants and difficult edge cases.docs/MANUAL_NOTIFICATIONS.md — exact DevOps CLI procedure, with independently checked command syntax.Identify the critical correctness risks before implementation.
Choose the simplest architecture that fulfills the requirements.
The planning phase must not produce the production implementation.
Read Terra's documents before writing production code.
Then:
FINAL_REPORT.md.The final report must contain actual commands executed, test results, architectural decisions, known limitations and incomplete requirements.
Do not claim tests passed unless they were executed.
Do not silently omit requirements.
If a design change is necessary, document its reason and update the corresponding plan.
@Bean and DAO usage examples.The evaluator will independently inspect the implementation and run additional tests.
Your own test results are not sufficient evidence of correctness.
Evaluation priorities:
Finish a working, verifiable implementation rather than adding unnecessary features.
Proceed autonomously using Terra for planning and DeepSeek for implementation.
Thanks for the detailed write-up, @magicprinc.
Most of the report is about the Java code the model generated for your benchmark: the Spring afterCommit handling, InheritableThreadLocal inheritance in virtual threads and NATS dispatcher initialization. None of that is about OpenCode itself. As you note, the results also depend on the model, the prompts and the review workflow each participant used, so it's hard to turn them into a concrete change in OpenCode.
To make this something maintainers can act on, could you describe briefly, in your own words:
opencode --version), the provider and model, and whether you used custom agents, rules or prompts for planning and review.You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done editing.
I searched for existing issues about benchmark feedback and didn't find any covering this.
Thanks for the clarification. I agree that the defects in the generated Java implementation are not necessarily defects in OpenCode itself. My intention was to identify opportunities to improve the reliability of agent-generated code.
1. Specific change I'd like in OpenCode
An optional independent verification/review agent, preferably with a configurable model.
After implementation, it would:
Crucially, the reviewer should receive the original requirements, not just the implementation agent's summary or test results, to reduce confirmation bias.
This should be an opt-in workflow, not mandatory overhead for every task. Ideally, it would integrate with existing agents and model configuration rather than introduce a separate framework.
2. Problem it would solve
In my Java 25 benchmark, OpenCode's implementation passed many of its own tests but missed important edge cases discovered through independent evaluation.
For example, the Spring transaction notification lifecycle contained a defect that could lose notifications.
The broader problem is that an implementation agent can write tests that confirm its own assumptions while overlooking cases where those assumptions are wrong.
I would like OpenCode to make independent, adversarial verification a convenient and repeatable part of the development workflow, especially for correctness-critical code.
I am not asking OpenCode to fix Java-specific bugs. I am proposing a harness-level mechanism that could help detect such bugs before delivery.
3. My setup
opencode v2.3.0).I can provide the exact model/provider identifiers and configuration if useful.
The benchmark was not a controlled comparison of harnesses because configurations and review workflows differed. Therefore, I would not treat the ranking as proof that one harness is intrinsically better.
The actionable proposal is an opt-in independent verification workflow focused on catching defects that the implementation agent and its own tests missed.
Thanks for the clear write-up, @magicprinc. That makes the request concrete.
The request: an opt-in, independent verification agent with its own configurable model. It would check the implementation against the original requirements (not the implementer's summary), look for correctness, concurrency, lifecycle and error-handling gaps, write and run adversarial tests, send findings back to the implementer, and repeat up to a configurable limit. Maintainers will consider it.
In the meantime, much of this can already be set up with agents and commands:
mode: subagent can have its own model and permissions. Subagents run with fresh context in their own child sessions, so the reviewer doesn't inherit the implementer's reasoning.subagent: true runs in a background child session. When it finishes, OpenCode sends the result back to the parent session, so the implementer can act on the findings.steps sets a maximum number of model steps for an agent.For example (the model ID and the requirements path are placeholders):
--- description: Independently verifies an implementation against the original requirements mode: subagent model: <provider>/<model>#high --- You are an independent, adversarial verifier. Read the ORIGINAL requirements you are given, not any summary of the work. Compare the implementation against every requirement. Treat each "documented limitation" or intentionally dropped case as a possible violation. Look for correctness, concurrency, resource-lifecycle, context-propagation and error-handling defects. Write additional adversarial tests, run them, and report each reproducible failure with the file, line and the requirement it violates.
--- description: Independent verification against the original requirements agent: verifier subagent: true --- Verify the current implementation against the original requirements in $ARGUMENTS.
Then run /verify docs/REQUIREMENTS.md after implementation and ask the main agent to fix what the verifier reports. Run it again until it's clean.
What this doesn't give you is a built-in loop that runs verification automatically after implementation and re-verifies fixes up to a configurable limit. That part of your request is the one for maintainers to consider.
I like OpenCode because it works out of box.
For those who want to configure everything from the morning to the evening → Pi already exists 😅
I like OpenCode because it works out of box. For those who want to configure everything from the morning to the evening → Pi already exists 😅
I think so too!
TL;DR
Simple proposal 👍
Run different Harnesses with the same model. Give a complex Java task and see what you get:
Judge with a top model using extra effort.
Tune your harness and repeat 🤷♀️🙏🤝
Thanks for the detailed write-up! Closing this since the problems listed are in the code the models generated, not bugs in opencode itself, and the suggestions are too broad to track as one issue. If you find a specific harness bug or have a concrete feature request, please open a separate issue for it.