Repository navigation
[Feature][CLI] Add accuracy benchmark for the AI CLI (100 tasks, layered verdict gates, repair-loop measurement) - #11553
Conversation
Implements the benchmark proposed in apache#11549: a standalone, deterministic evaluation harness measuring how accurately the AI CLI turns natural language into runnable SeaTunnel configs, across LLM providers/models and across CLI versions. Task suite: 100 declarative JSON tasks in three complexity tiers (20 simple / 45 medium / 35 complex-DAG) covering 12 ETL scenario categories, with 10 Chinese-language prompts and 18 rule probes targeting known LLM failure modes (conditional option misuse, BATCH-vs-STREAMING inference, plugin_input/plugin_output wiring). Verdict gates mirror the CLI's own check -> dry-run -> run pipeline: L1 static scoring.py: pyhocon parse + connector metadata + per-task assertions (offline, no engine needed) L2 dry-run execution.py: seatunnel.sh --dry-run static L3 execute execution.py: real job execution on the official apache/seatunnel image against the docker-compose data environment (MySQL/PostgreSQL/Kafka/ClickHouse/ Elasticsearch/MinIO, optional Doris/StarRocks profile); batch verdict by exit code, streaming by 60s health Gates degrade gracefully: missing engine/docker disables deeper gates per task instead of failing the run. Repair loop: on a failed gate, the gate's real error output is fed to the CLI's own repair agent (bounded rounds), yielding pass@1 / pass@<=k and per-gate repair conversion rates. All verdicts are deterministic (exit codes, liveness, regex assertions) - no LLM-as-judge. Runner: multi-model matrix via models.json or single-model flags (--provider/--model/--api-key), --trials for pass^k reliability, CLI version + git commit stamped into every report for A/B comparison across CLI changes. run_benchmark.sh is the one-command entry point (dependency install, environment preflight, run, report). Reports: console summary plus summary.md / summary.csv / results.json (first-attempt layer funnel, repair curve, per-tier and per-category matrices, timing). Compliance and hygiene: credentials are read from environment variables only and never written to files; benchmark results/ and models.json are git-ignored; the workaround for the image-level opengauss-jdbc driver conflict (apache#11510) is documented inline and applied identically for every model. Found by earlier runs of this benchmark: apache#11508 (fixed in apache#11509), apache#11510, apache#11511. Documentation for the results lives on the website under AI CLI -> Model Benchmark (apache#11551).
…/sql files The docker-compose file, init SQL/shell scripts, and run_benchmark.sh carried a truncated 3-line attribution instead of the complete Apache License 2.0 header required by the license-eye CI check.
There was a problem hiding this comment.
What problem this PR solves
- User pain: The AI CLI lacked a repeatable way to compare natural-language-to-SeaTunnel-config accuracy or measure whether prompt, metadata, and repair changes improve it.
- Fix approach: Add a one-hundred-task suite, L1 static checks, optional L2 validation/L3 execution, a repair loop, Docker data environment, and CSV/Markdown/JSON reports.
- One-line summary: The benchmark foundation is valuable, but it leaks API keys, miscounts repairs/skips/semantic passes, breaks its wrapper, and misconfigures PostgreSQL.
- Before: Prompt/metadata changes could be judged only ad hoc.
- After: The intent is to compare pass@k over the same one hundred tasks; in reality an internally repaired result can still be PASS@1, or requested L3 can succeed after only L1.
1. Code-change review
1.1 Core logic and real call/execution chain
- Behavior before: There was no unified accuracy/repair benchmark.
- Behavior after: The tool can sequentially execute one hundred tasks and layered gates and produce reports, but repair/gate-eligibility/semantic-correctness/security contracts are unreliable.
- Normal-path hit:
hit— The wrapper/runner is the README-recommended entry; every model×task×trial calls run_task_with_repairs/evaluate_layers.
Multi-table Sink Writer contract audit
- Applicable:
false - Sink implements SupportMultiTableSink:
Not reported by GitHub - createWriter returns the required subclass:
Not reported by GitHub - optionRule contains the replica option:
Not reported by GitHub - Evidence: Not applicable: developer benchmark tooling.
1.2 Compatibility impact
- Classification:
fully_compatible(fully compatible) - API: Standalone tooling is additive and does not change shipped public runtime APIs.
- SPI: No connector/engine SPI change.
- Configuration: Only benchmark CLI/task configuration is added; SeaTunnel Options are unchanged.
- Defaults: Existing CLI defaults are unchanged.
- Protocol and serialization: Adds results/task JSON formats with no shipped compatibility burden yet.
- Checkpoint/restore: No engine checkpoint/state-serializer change.
- Historical behavior: Existing CLI/runtime behavior is unchanged.
- Migration guidance: Additive developer feature; no migration.
- Incompatible-changes documentation: No incompatible-change entry is required.
1.3 Performance and side effects
- CPU: One hundred tasks×models×trials×repairs is intentionally large offline work; hidden repairs make cost exceed the advertised bound.
- Memory: Sequential execution bounds active memory; results/config history grows with run size and is written to disk.
- GC: Python task/result objects are bounded by the run; no unbounded daemon cache.
- Network: Every generation/repair calls a model provider; hidden repairs add billable calls.
- Lock contention: No parallel worker or new lock.
- Concurrency safety: Tasks are sequential; the shared CLI data directory may carry state across tasks/models but has no concurrent writers.
- Retry: Up to three product-internal rounds plus benchmark outer repairs make actual retry counts differ from reports.
- Idempotency: Dynamic output/task workspaces are not fully cleaned; the Docker seeded environment depends on setup state.
- Resource release: Streaming process groups/containers are killed in finally and temp configs unlinked; shared CLI data/output artifacts remain.
- Overall: Cost is appropriate for an offline benchmark, but incorrect denominators/hidden repairs make cost and performance interpretation unreliable.
1.4 Error handling and logging
- Exception propagation: Subprocess timeouts/nonzero exits enter results; None skips become success and wrapper set -e/-u causes entry failure.
- Context: Engine output tails are written to results; infrastructure skip reasons exist but denominators do not preserve them.
- Log levels: No standard-logger misuse blocker was found in the Python/shell developer tooling.
- Sensitive information: Result model configuration does not directly save API keys, but the documented argv path exposes the secret.
- Overall: Credential handling and skipped-as-success are blockers; process error tails are otherwise useful.
1.5 Diff integrity, deletion ledger, and scope audit
- intended_change_correctness:
blocking - diff_integrity:
pass - deletion_ledger: total=
0, classified=0, unclassified=0 - Reconciliation: 0 = 0 + 0
Deletion, rename, and disappeared-capability ledger
- The complete diff contains no deletion, rename, or disappeared-capability item requiring classification.
Scope and base-drift items
-
No out-of-scope hunk, stale-base change, or merge artifact requires a separate ledger entry.
-
Out-of-scope hunk conclusion: None found; all nineteen files are benchmark, tests, or focused .gitignore additions.
-
Stale-base conclusion: None found; current-dev compare is ahead three and behind zero.
-
Merge-artifact conclusion: No deleted/renamed files or conflict artifacts; REST reports mergeable=true.
2. Code-quality assessment
2.1 Code conventions, title format, and comments
- Title format:
[Feature][CLI]is not among listed module tokens; consider the conventional core/CLI module; non-blocking. - Code conventions: git diff --check is clean; run_benchmark.sh has duplicate partial license text as a low-priority cleanup.
- Comment completeness: Core nontrivial runner/report methods lack input, denominator, side-effect, and invariant docstrings.
2.2 Test coverage and stability
- Unit tests:
missing— Twelve tests cover basic L1/task metadata, but not core metrics/execution. - Component tests:
missing— Runner↔Orchestrator repair-trace, aggregation, and report-denominator tests are missing. - Engine integration tests:
missing— Backend-aware endpoint/preflight contract tests are missing. - E2E:
missing— The benchmark was not run and ninety-six tasks lack a semantic sink-verification contract. - Regression tests:
missing— Wrapper no-TTY, secret-argv, skip=None, hidden-repair, and PostgreSQL-port regressions are missing. - Stability classification:
high_risk
Test-stability evidence
run_benchmark.sh:35-41,60-68,78-90- Trigger: Any documented wrapper arguments, or a Docker-capable environment without services.
- Probability basis: Unset
prev_argtriggers on the first iteration with 100% probability under set -u; interactive read depends on environment/TTY. - Analysis: The primary entry deterministically fails and can block unattended execution, a High blocking stability defect.
docker-compose.yml:59-75 / execution.py:92-107,140-145,273-286- Trigger: Recommended local-engine plus Docker-PostgreSQL setup.
- Probability basis: The host-port mismatch deterministically affects fifteen tasks unless an unrelated host DB happens to listen on 5432.
- Analysis: Results drift with host state and the benchmark is not reproducible.
Missing scenarios
- One internal repair must report round one, not PASS@1.
- Eligibility/denominators for requested but skipped L2/L3.
- All backend endpoint mappings and service connectivity.
- Semantic output/progress checks for every executable task.
2.3 Documentation
- User-visible change:
true - docs/en: The benchmark README documents methodology/setup, but security, non-blocking preflight, and pass semantics conflict with implementation.
- docs/zh: No matching docs/zh benchmark guidance is added; developer-only scope still needs support-boundary documentation.
- Examples: Quick-start examples place an
--api-keyplaceholder directly in argv. - Configuration truth: PostgreSQL-port, all-enabled-gates, and repair-count claims conflict with implementation.
- URL truth: No new external-URL rollback was found; the core problem is command/configuration truth.
2.4 Local-validation boundary and GitHub CI evidence
- Local boundary: Static full diff/source/task-inventory/call-chain/deletion/history and current-head CI only; benchmark/engine/Docker/real-provider calls were not executed.
3. Architecture assessment
3.1 Solution type: precise fix / workaround / long-term design
- Type:
long_term_design - Assessment: Layering tasks/scoring/execution/report is a maintainable foundation, but the core metric contract must be rebuilt around one observable repair trace and explicit gate eligibility.
3.2 Maintainability
Structured task JSON and separated modules aid extension; missing docstrings/tests let denominator semantics drift.
3.3 Extensibility
Explicit requested/applicable/executed states and per-task semantic probes can extend to new connectors/engines.
3.4 Historical-version compatibility
Standalone tooling is additive and does not affect shipped historical runtime.
4. Disposition ledger for findings from other reviewers
- total=
0, confirmed=0, resolved_in_current_head=0 - rejected_with_same_proposition_evidence=
0, not_applicable_with_reason=0, unresolved=0 - Reconciliation: 0 = 0 + 0 + 0 + 0 + 0
After excluding the author and Daniel, this round has no technical finding to ingest.
5. Formal findings
issue-1 — The documented API-key path exposes credentials through argv
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/run_benchmark.sh:27-78 - Thread: Not reported by GitHub
- Problem and real execution path: README quick starts place the secret in
--api-key; the wrapper forwards raw$@to Python, and copying it into the environment happens only after shell-history/process-list disclosure. User command → shell argv/history → run_benchmark.sh$@→ Python argparse → os.environ. - Current-head evidence: Argparse explicitly accepts a secret-valued option and every OpenAI/Anthropic example shows a literal secret.
- Trigger condition: A user follows any documented one-command path with a real API key.
- Potential impact: During a long benchmark the secret is exposed through history and process monitoring, enabling paid abuse or data access.
- Best actionable fix: Remove the secret CLI value; use provider-standard environment variables or a hidden stdin/keyring prompt, and test that child args/results contain no credential.
- Severity:
high - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
issue-2 — The one-command wrapper deterministically crashes after a run and preflight can block or exit
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/run_benchmark.sh:35-90 - Thread: Not reported by GitHub
- Problem and real execution path: Under
set -u, the first loop uses uninitializedprev_arg; the allegedly informational Docker preflight unconditionally performs an interactiveread, which can exit under set -e without a TTY. Wrapper preflight → optional read → Python benchmark → output-path loop expands unset prev_arg. - Current-head evidence: Every documented invocation has at least one argument, deterministically triggering the first iteration; Docker hosts without services enter read.
- Trigger condition: Any advertised wrapper invocation, or an unattended host without benchmark containers running.
- Potential impact: The wrapper fails after a successful benchmark and omits its conclusion, while automation can wait on stdin.
- Best actionable fix: Initialize the variable or use robust while/case parsing; prompt only on a TTY or require explicit
--start-docker, and add shell-level regressions. - Severity:
high - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
issue-3 — Pass@1 and the repair curve hide up to three product repair rounds
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/runner.py:175-241 - Thread: Not reported by GitHub
- Problem and real execution path: The benchmark treats
Orchestrator.process_user_inputoutput as round zero, although that method already runs up to three validator/_run_fix rounds; the outer loop records only later repairs. Benchmark run_task_with_repairs → process_user_input internal repair loop → returned config mislabeled round zero → outer repair loop. - Current-head evidence:
agents.py:1413-1469can call_run_fixthree times before return;--max-repairs 0still allows hidden repairs. - Trigger condition: The initially generated config fails validation and is repaired inside the product loop.
- Potential impact: A repaired config is reported as PASS@1, pass@k and average repairs are systematically understated, invalidating a core benchmark claim.
- Best actionable fix: Expose a complete supported benchmark trace or provide a generation-only API so the benchmark owns the sole validation/repair timeline; add a round-number regression.
- Severity:
high - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
issue-4 — Requested but skipped L2/L3 gates count as repair-curve successes
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/runner.py:118-226 - Thread: Not reported by GitHub
- Problem and real execution path:
evaluate_layersstarts with all_passed=True and fails only onpassed is False; Docker L2, task skip, missing engine/service return None yet first_pass_round is still set. Resolve requested layers → a layer returns None → all_passed remains true → repair curve/tier/category/CSV consume first_pass_round. - Current-head evidence: The layer funnel excludes None while other aggregations have no completeness/eligibility denominator.
- Trigger condition: L2/L3 is requested but backend/task/service conditions skip a layer.
- Potential impact: Machines with different coverage appear comparable, and requested L3 can pass after only L1.
- Best actionable fix: Represent requested/applicable/executed/passed/skipped explicitly; fail closed or exclude incomplete trials, and display denominators.
- Severity:
high - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
issue-5 — L3 accepts most runnable but semantically wrong jobs as accurate
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/execution.py:297-412 - Thread: Not reported by GitHub
- Problem and real execution path: Batch L3 checks only exit zero and streaming checks only sixty-second liveness/a short error regex; only four of one hundred tasks have sink verification, while L1 permits extra topology and regexes raw text. Generated config → L1 subset/text checks → L3 process exit/liveness → optional verification absent for 96 tasks → pass.
- Current-head evidence: Suite facts: one hundred unique tasks, ninety-nine marked L3, thirty streaming, and only four execution.verify entries.
- Trigger condition: A job starts but reads no data, writes wrong output, routes incorrectly/adds an extra sink, or only a comment matches an intent regex.
- Potential impact: The benchmark gives semantically incorrect pipelines full passes, distorting model/regression accuracy conclusions.
- Best actionable fix: Give every executable task deterministic semantic probes: exact rows/schema for batch, progress plus content for streaming, and parsed topology/cardinality for L1.
- Severity:
high - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
issue-6 — The recommended local-engine L3 setup cannot reach PostgreSQL for fifteen tasks
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/docker/docker-compose.yml:59-75 - Thread: Not reported by GitHub
- Problem and real execution path: Compose exposes host 15432 to container 5432, while the README and fifteen tasks use localhost:5432; local SEATUNNEL_HOME is preferred and only the Docker-engine path rewrites hosts. README full setup → local engine backend → unchanged task JDBC localhost:5432 → Compose PostgreSQL actually localhost:15432.
- Current-head evidence: The three task JSON files contain fifteen PostgreSQL prompts; execution host rewriting excludes the local backend.
- Trigger condition: Follow recommended
SEATUNNEL_HOMEplus Docker data environment with no unrelated PostgreSQL on host port 5432. - Potential impact: Fifteen L3 tasks fail from infrastructure mismatch, or can test the wrong database if another DB owns host port 5432.
- Best actionable fix: Map endpoints by backend (host localhost:15432/container postgres:5432), or expose/document one consistent port, with a connectivity precheck.
- Severity:
high - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
issue-7 — Core benchmark/report and security contracts lack documentation and tests
- Source reviewer: DanielLeens
- Location:
seatunnel-cli/benchmark/runner.py:280-361 - Thread: Not reported by GitHub
- Problem and real execution path: Nontrivial contracts such as
run_benchmark,_aggregate,_write_csv, and_write_markdownlack docstrings; twelve tests cover only basic scoring and task metadata. Runner execution/aggregation/reporting plus wrapper/security/endpoint paths have no deterministic contract tests. - Current-head evidence: Repair timelines, skipped gates, denominators, wrapper behavior, API-key safety, backend endpoints, and L2/L3 are uncovered.
- Trigger condition: Future maintenance or any core-semantic regression.
- Potential impact: All six deterministic/correctness/security defects pass current CI and metric contracts can drift silently.
- Best actionable fix: Add English docstrings for important methods and mocked/unit/shell tests; environment-backed L3 may remain opt-in, but aggregation semantics require unit tests.
- Severity:
medium - Merge gate:
blocking - Current-head disposition:
confirmed_in_current_head - Already raised by another reviewer:
false - Other finding ID:
Not reported by GitHub
6. Findings summary
| ID | Finding | Location | Severity | Merge gate |
|---|---|---|---|---|
| issue-1 | The documented API-key path exposes credentials through argv | seatunnel-cli/benchmark/run_benchmark.sh:27-78 | high | blocking |
| issue-2 | The one-command wrapper deterministically crashes after a run and preflight can block or exit | seatunnel-cli/benchmark/run_benchmark.sh:35-90 | high | blocking |
| issue-3 | Pass@1 and the repair curve hide up to three product repair rounds | seatunnel-cli/benchmark/runner.py:175-241 | high | blocking |
| issue-4 | Requested but skipped L2/L3 gates count as repair-curve successes | seatunnel-cli/benchmark/runner.py:118-226 | high | blocking |
| issue-5 | L3 accepts most runnable but semantically wrong jobs as accurate | seatunnel-cli/benchmark/execution.py:297-412 | high | blocking |
| issue-6 | The recommended local-engine L3 setup cannot reach PostgreSQL for fifteen tasks | seatunnel-cli/benchmark/docker/docker-compose.yml:59-75 | high | blocking |
| issue-7 | Core benchmark/report and security contracts lack documentation and tests | seatunnel-cli/benchmark/runner.py:280-361 | medium | blocking |
7. Merge conclusion
Conclusion:can merge after fixes
Blocking items
blocker-1[source] (issue-1): The documented API-key path exposes credentials through argvblocker-2[source] (issue-2): The one-command wrapper deterministically crashes after a run and preflight can block or exitblocker-3[source] (issue-3): Pass@1 and the repair curve hide up to three product repair roundsblocker-4[source] (issue-4): Requested but skipped L2/L3 gates count as repair-curve successesblocker-5[source] (issue-5): L3 accepts most runnable but semantically wrong jobs as accurateblocker-6[source] (issue-6): The recommended local-engine L3 setup cannot reach PostgreSQL for fifteen tasksblocker-7[tests] (issue-7): Core benchmark/report and security contracts lack documentation and tests
Non-blocking recommendations
- No additional non-blocking finding is recorded.
Overall assessment
The inventory and architecture are valuable, but current metrics/security/execution truth cannot support model/CLI decisions.
Better alternative implementation and trade-offs
- Alternative: Expose a generation-validation-repair trace from the CLI; let the benchmark count it once, model gate coverage explicitly, give every executable task semantic probes, and use backend-safe endpoints/credentials.
- Trade-offs: This is more work than patching report labels but yields reproducible metrics and avoids publishing misleading benchmark numbers.
…ng, PG port mapping, credential guidance Addresses the review findings on the benchmark harness: 1. Credential exposure (issue-1): README quick starts now use provider-standard environment variables; --api-key remains accepted but is documented as suitable only for throwaway keys. 2. Wrapper defects (issue-2): prev_arg is initialized before the --out scan (previously crashed under set -u after every run); the Docker preflight prompt runs only on a TTY and prints the manual command otherwise, so unattended runs never block on stdin. 3. Repair-round semantics (issue-3): the measurement unit is documented explicitly - round 0 is the CLI's first delivered config (the CLI may internally fix up to 3 times; that is the product under test). Internal fix rounds are now counted via the Orchestrator status callback and recorded per trial as internal_repair_rounds (results json + CSV), so both timelines are observable without changing product code. 4. Gate-skip accounting (issue-4): evaluate_layers records skipped_layers and all_gates_executed per trial; requested-but- skipped layers are never counted as passes of that layer, the CSV carries both fields, and the summary prints a per-model warning with the count of incomplete-coverage trials. 5. L3 verdict scope (issue-5): documented in the README - batch exit code (+ verify probes where defined) and streaming health; per-task semantic probes are the intended extension path. 6. PostgreSQL port mapping (issue-6): the compose file remaps the host port to 15432; the local-engine backend now rewrites canonical localhost:5432 endpoints to the remapped host port (mirroring the docker backend's hostname rewrite), and the README service table documents both. Fixes 15 PostgreSQL tasks under the recommended local-engine setup. 7. Docs/tests (issue-7): docstrings for aggregation denominators; 4 new unit tests covering skip-vs-fail semantics and coverage accounting.
|
All seven findings addressed in head
|
yzeng1618
left a comment
There was a problem hiding this comment.
Request changes on the current head.
- High — skipped requested gates are still counted as benchmark successes.
evaluate_layers()deliberately leavesall_passed=Truefor a skipped L2/L3 (lines 165-180), andrun_task_with_repairs()setsfirst_pass_roundfrom that flag (lines 244-253). The report then derives pass@1, pass@k, per-tier/category rates, and the CSVpassedcolumn fromfirst_pass_round(for example,report.py:101-117and `report.py:267-275). As a result, a trial that only completed L1 because L2/L3 was unavailable is both warned about and included as a successful full-gate trial. This contradicts the stated contract and makes results from different environments incomparable.
Please make the pass predicate require all_gates_executed whenever a requested gate is skipped, or maintain separate partial_gate_pass and full_gate_pass values and use only the latter for every advertised pass@k/pass^k aggregate. Add a regression covering a skipped L3 trial and asserting that it cannot increase pass@1 or the CSV passed value.
- Medium — one unexpected task failure aborts the whole model run and leaks its model environment into subsequent process state. The call at
runner.py:352has no per-task exception boundary, andrestore_env(previous_env)is not protected byfinally(lines 329-382).score_task, setup-file creation, subprocess construction, or report persistence can therefore terminate a 100-task comparison rather than recording one failed trial; it also leavesAI_PROVIDER/model variables modified. Please usetry/finallyfor restoration and convert unexpected task exceptions into a structured failed record with the traceback/detail.
The benchmark is a useful addition, but its primary product claim is comparable CLI accuracy. These two paths currently make the headline metrics optimistic or incomplete, so it should not merge until they are fixed and covered by tests.
davidzollo
left a comment
There was a problem hiding this comment.
Reviewed the current head 3e4299bb929dd559f3b631e410578d67205ef26b.
The benchmark structure is useful, and several earlier issues are already addressed, but the current head still has one blocker in the headline metric contract plus two additional issues that should be fixed before merge.
- High: requested-but-skipped L2/L3 gates are still counted as pass@k successes.
evaluate_layers() records skipped requested gates with skipped_layers and all_gates_executed=false, but it keeps all_passed=true when a requested L2/L3 returns passed=None (seatunnel-cli/benchmark/runner.py:134-180). run_task_with_repairs() then sets first_pass_round from layers["all_passed"] (runner.py:244-253). The report uses first_pass_round for pass@1/pass@k, tier/category rates, pass^k, and the CSV passed column (report.py:101-126, report.py:267-275).
So a run requested at L3 can execute only L1, emit a warning about incomplete coverage, and still increase the advertised full-gate pass@1/pass@k metrics. That makes benchmark results optimistic and incomparable across machines with different Docker/engine/service availability. The existing regression only proves the incomplete trial is counted as incomplete; it does not prove it is excluded from success metrics (tests/test_benchmark_gates.py:92-107).
Please split the semantics explicitly, for example:
executed_layers_passed: all layers that actually ran passed.full_gate_passed: all requested/applicable gates executed and passed.
Then drive every advertised pass@k/pass^k/tier/category/CSV passed metric from full_gate_passed, or publish separate partial-coverage metrics with separate denominators. Add a regression where L3 is requested and skipped, and assert it does not increase pass@1 or CSV passed.
- Medium: one unexpected task failure can abort the whole model run and leave provider/model env modified.
run_benchmark() applies model environment variables at runner.py:329, but restore_env(previous_env) is only called after the full model loop (runner.py:381-382) and is not protected by finally. Also, the per-task call to run_task_with_repairs() and config persistence are not inside a task-level exception boundary (runner.py:342-373). A single unexpected exception from scoring, setup-file creation, execution command construction, or config persistence can terminate the 100-task comparison instead of recording one failed trial, and can leave AI_PROVIDER, OPENAI_MODEL, etc. polluted for the rest of the process.
Please wrap model execution with try/finally for environment restoration and convert per-task/per-trial unexpected exceptions into a structured failed record with detail/traceback, so the benchmark remains comparable and debuggable.
- Medium:
git diff --checkcurrently fails.
git diff --check upstream/dev...HEAD reports trailing whitespace at seatunnel-cli/tests/test_benchmark_gates.py:41.
Current GitHub Build is green and there is no merge conflict, but because the benchmark's primary product is trustworthy comparable metrics, the skipped-gate success accounting should block merge.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-reviewed the current head and also read the newer reviews from @yzeng1618 and @davidzollo. I agree with their main concern: the remaining issue is in the benchmark's core success contract, so I still think this needs changes before merge.
What this PR fixes
- User pain point: the AI CLI needs a repeatable way to compare natural-language-to-SeaTunnel-config accuracy across models, prompts, metadata, and repair behavior.
- Fix approach: add a 100-task suite, L1/L2/L3 gates, a repair loop, Docker-backed data services, and CSV/Markdown/JSON reports.
- In one sentence: this is a valuable benchmark foundation, but the current pass@k/full-gate accounting can still report partial coverage as success.
1. Code Review
1.1 Core Logic
The current execution path is:
benchmark run
-> run_benchmark(models, tasks, levels)
-> apply_model_env(model_cfg)
-> create_provider(...)
-> for each task/trial:
-> run_task_with_repairs(client, task, levels, max_repairs)
-> Orchestrator.process_user_input(prompt)
-> evaluate_layers(task, config, levels)
-> L1 score_task
-> L2 run_dry_run, passed=None => skipped_layers += l2, all_gates_executed=false
-> L3 run_execute, passed=None => skipped_layers += l3, all_gates_executed=false
-> if layers["all_passed"] => first_pass_round = round_num
-> report._aggregate(results)
-> pass@k / tier / category / CSV passed still derive from first_pass_round
The good news is that skipped requested gates are now visible through skipped_layers and all_gates_executed=false. The blocker is that first_pass_round is still set from layers["all_passed"], and all_passed remains true when a requested L2/L3 returns passed=None. The report then still uses first_pass_round for the advertised success metrics.
1.2 Compatibility
Fully compatible. This is additive developer tooling and does not change SeaTunnel runtime APIs, user connector options, defaults, protocol, serialization, or checkpoint behavior.
1.3 Performance / Side Effects
The offline cost of 100 tasks × models × trials × repairs is expected. The bigger risk is decision quality: if partial L1-only runs can increase L3 pass@k, the benchmark can steer model/CLI decisions using optimistic metrics.
1.4 Error Handling and Logging
+1 to @davidzollo's point about the missing try/finally around model env restoration and the lack of a per-task exception boundary. One unexpected task failure should become a structured failed trial, not abort the whole model comparison or leave provider/model env polluted.
Formal findings:
-
High: requested-but-skipped L2/L3 gates still count as pass@k successes.
- Location:
seatunnel-cli/benchmark/runner.py,seatunnel-cli/benchmark/report.py - This is the same core issue raised by @yzeng1618 and @davidzollo.
evaluate_layers()records skipped layers, butrun_task_with_repairs()still setsfirst_pass_roundfromlayers["all_passed"], andreport.pystill derives pass@k, tier/category rates, and CSVpassedfromfirst_pass_round. - Risk: a run requested at L3 can execute only L1 and still improve the advertised full-gate pass@1/pass@k numbers.
- Suggested fix: split the semantics explicitly, for example
executed_layers_passedversusfull_gate_passed, and drive every advertised pass@k/pass^k/tier/category/CSVpassedmetric from the full-gate value. Add a regression where L3 is requested and skipped, and assert that it does not increase pass@1 or CSVpassed. - Severity: high.
- Already raised by others: yes, @yzeng1618 and @davidzollo.
- Location:
-
Medium: unexpected task failures can abort the model run and env restoration is not protected by
finally.- Location:
seatunnel-cli/benchmark/runner.py - This overlaps with @davidzollo's review. Please restore model env in
finallyand convert per-task/per-trial unexpected exceptions into structured failed records. - Severity: medium.
- Already raised by others: yes, @davidzollo.
- Location:
-
Medium:
git diff --checkcurrently fails.- Location:
seatunnel-cli/tests/test_benchmark_gates.py - I reproduced the trailing whitespace at line 41 with
git diff --check apache/dev...HEAD. - Severity: medium.
- Already raised by others: yes, @davidzollo.
- Location:
2. Code Quality
2.1 Style
The module separation is good, but the git diff --check failure should be cleaned up.
2.2 Tests and Stability
Test stability rating: high risk. The new tests show incomplete gate trials are counted, but they do not yet prove incomplete trials are excluded from pass@1/pass@k/CSV success metrics. That is the regression that needs to be locked down.
I did not run local tests in this batch; this review is based on current-head source analysis and GitHub CI evidence, as requested.
2.3 Docs
The README is useful, but the benchmark's documented full-gate/pass@k meaning should not be considered accurate until the metric contract is fixed.
3. Architecture
The architecture is promising: task inventory, scoring, execution, and reporting are separated cleanly. I would make the gate state model explicit: requested, applicable, executed, passed, skipped, and full-gate passed should be separate facts rather than inferred from one all_passed boolean.
4. Findings Summary
| No. | Finding | Location | Severity |
|---|---|---|---|
| 1 | Requested-but-skipped L2/L3 gates still count as pass@k successes | runner.py, report.py |
High |
| 2 | Unexpected task failure/env restoration handling is incomplete | runner.py |
Medium |
| 3 | git diff --check trailing whitespace |
test_benchmark_gates.py |
Medium |
5. Merge Conclusion
Conclusion: can merge after fixes
-
Blockers that must be fixed
- Finding 1: the benchmark's advertised full-gate success metrics are still optimistic when requested gates are skipped.
-
Non-blocking suggestions
- Finding 2: please add
try/finallyenv restoration and structured failed records for unexpected task errors. - Finding 3: please remove the trailing whitespace.
- Finding 2: please add
Overall, this is a useful direction, but the metric contract is the product here. I would not merge it until skipped requested gates are excluded from the advertised pass@k/full-gate success path.
…s, per-task fault isolation 1. Skipped requested gates no longer count toward any success metric: evaluate_layers computes full_gate_passed (all requested gates executed AND passed) and first_pass_round is set only from it, so pass@1/pass@<=k/pass^k, per-tier/category rates, and the CSV passed column can never be inflated by partial coverage. all_passed is kept solely for repair-loop control (a skipped gate is not repairable). New regression runs the full run_task_with_repairs path with a skipped L3 and asserts first_pass_round stays None while full_gate_passed=false and no repair is attempted. README metric definitions updated accordingly. 2. Per-task fault isolation and env hygiene: an unexpected harness exception (scoring crash, setup-file I/O, subprocess construction) becomes one structured failed trial carrying the traceback instead of aborting the whole model run; restore_env now runs in a finally so provider/model environment variables are restored even when a model run dies. 3. Removed trailing whitespace flagged by git diff --check.
|
@yzeng1618 @davidzollo Both of you called the same core defect and you were right — my previous round only warned about skipped gates without excluding them from the metrics. Fixed in head
|
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-reviewed the latest head 8cef011d59d2 from scratch, including the newer fixes for the benchmark success contract.
What this PR fixes
- User pain: the AI CLI needs a repeatable way to compare natural-language-to-SeaTunnel-config accuracy across models, prompts, metadata, and repair behavior.
- Fix approach: add a benchmark runner, 100-task suite, L1/L2/L3 gates, Docker-backed services, repair loop, and JSON/CSV/Markdown reports.
- In one sentence: this now provides a useful benchmark foundation with the headline pass@k metrics tied to full-gate coverage rather than partial execution.
Runtime path checked
benchmark run
-> run_benchmark(models, tasks, levels)
-> apply_model_env(model_cfg)
-> create_provider(...)
-> for each task/trial
-> run_task_with_repairs(...)
-> Orchestrator.process_user_input(...)
-> evaluate_layers(...)
-> L1 score_task
-> L2/L3 may pass/fail/skip
-> skipped gate sets all_gates_executed=false
-> full_gate_passed = all_passed && all_gates_executed
-> first_pass_round is set only when full_gate_passed=true
-> finally restore_env(previous_env)
-> report pass@k / CSV passed derive from first_pass_round
The normal benchmark path does hit the previous blocker area. The important part is fixed now: a requested-but-skipped L2/L3 no longer increments first_pass_round, so it cannot inflate pass@1/pass@k or the CSV passed column. The model environment is also restored under finally, and an unexpected per-task harness exception is recorded as a failed trial instead of aborting the whole model run.
Compatibility / side effects
Fully compatible. This is additive developer tooling and does not change SeaTunnel runtime APIs, connector options, defaults, protocols, serialization, or checkpoint behavior.
Test coverage and stability
The new tests cover skipped gate accounting, full-gate success, L3 failure, incomplete gate trial aggregation, internal repair round preservation, task loading, scoring weights, connector/mode/content checks, and variable argument handling. The tests use mocks/static data and do not depend on real Docker, network, ports, wall-clock sleeps, or service startup ordering. Stability rating: stable.
Merge conclusion
Conclusion: can merge
- Blocking items that must be fixed
- None from Daniel's current review.
- Non-blocking suggestions
- None from this review.
Overall, I agree with the direction now. The earlier benchmark metric blocker is closed, and the current Build is green, so I am approving this revision from Daniel's side.
Purpose of this pull request
Implements #11549 — adds a standalone accuracy benchmark for the AI CLI under
seatunnel-cli/benchmark/. All new files; no product code changes.The benchmark answers a question the project previously could not answer quantitatively: when the CLI's prompts, connector metadata, or repair logic change, does config-generation accuracy actually improve — and by how much, for which models?
What's included (19 files, ~4,000 lines):
tasks/tier{1,2,3}_*.jsonscoring.pyexecution.py--dry-run static; real job execution on the officialapache/seatunnelimage (batch: exit code; streaming: 60s health)docker/runner.pymodels.jsonor--provider/--model/--api-key), repair loop driven by the failing gate's real errors,--trialsfor pass^k, CLI version + commit stampingreport.pyrun_benchmark.shtests/test_benchmark_scoring.pyDesign guarantees:
results/andmodels.jsonare git-ignored.Track record: runs of this benchmark found and isolated #11508 (fixed in #11509), #11510 (image-level opengauss-jdbc driver conflict — workaround documented inline and applied identically for every model), and #11511. Measured results for 7 models are documented on the website (AI CLI → Model Benchmark, #11551).
Does this PR introduce any user-facing change?
No changes to shipped behavior. Adds an optional developer tool under
seatunnel-cli/benchmark/with its own README; two.gitignoreentries for runtime artifacts.How was this patch tested?
tests/test_benchmark_scoring.py: 12 tests covering the L1 scorer (structure checks, connector matching, assertion evaluation, credential-placeholder handling) and task-suite integrity (100 tasks load, unique ids, compilable regexes, service references match the compose file). Full seatunnel-cli suite: 54 passed.