Skip to content

fix: explain missing MySQL telemetry adapter column - #883

Open
gezerui888 wants to merge 2 commits into
Tencent:mainfrom
gezerui888:fix/mysql-telemetry-schema-guidance
Open

gezerui888 wants to merge 2 commits into
Tencent:mainfrom
gezerui888:fix/mysql-telemetry-schema-guidance

Conversation

@gezerui888

Copy link
Copy Markdown

What changed

Refs #201, specifically the external MySQL telemetry diagnostic.

Filtering telemetry fails with a raw MySQL 1054 error when run_telemetry.adapter is missing. I add guidance to inspect existing columns and apply only missing statements from migrations/001_run_obs_generated_columns.sql. The diagnostic preserves the underlying error and HTTP 400 status.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

Valid telemetry queries keep their existing results. The change performs no schema writes. Startup validation and analytics diagnostics remain separate parts of #201.

Validation

  • Disposable MySQL: the new diagnostic regression fails on main and passes with this change. Prepared-schema and unrelated-error controls pass. The HTTP probe preserves the successful response after applying the shipped SQL.
  • Full repository suite with separate prepared MySQL databases: main 637 passed / 8 skipped, candidate 641 passed / 8 skipped.
  • go test -p=2 ./... -count=1 -timeout=180s, with the workflow's browser exclusion: main hit the HTTP package time limit. Both complete HTTP reruns pass with -timeout=600s.
  • Completed Go comparison: main 4,839 passed / 9 failed / 90 skipped, candidate 4,840 passed / 8 failed / 91 skipped. No new failures. Counts include parent tests and subtests. The additional DSN-gated regression executes separately above.
  • Non-browser coverage: 85.8854%, above the 84.8% gate. Main is 85.9019%.
  • bash scripts/build-chatbot.sh: production build succeeds. Frontend tests have the same 341 passes and 27 failures on both branches.
  • go vet ./..., python3 scripts/check-public.py, and git diff --check pass.
  • bash scripts/scan-secrets.sh exits 126 on both branches. Native gitleaks 8.30.1 passes with the same configuration.
  • Not run: five real-browser tests, public browser acceptance, and live-provider acceptance. Local-edition checks do not apply to this platform-only change.

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable. Not applicable.
  • I documented third-party content and licensing changes when applicable. Not applicable.

cc @cocofhu

Yanami-2K
Yanami-2K previously approved these changes Nov 15, 2026

@Yanami-2K Yanami-2K left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

核对了 #201 的要求:该 issue 剩余的第 2 点包含“应用侧缺列时友好报错”,本 PR 以 Refs 方式只处理这一部分,没有采用 issue 中明确否决的“退回 JSON 解析”,也没有在启动路径写库,范围与描述一致。internal/repo/runs.go 的 QueryRunTelemetry 只在 MySQL 1054 且缺失列为 'adapter' 时包装错误,并用 %w 保留底层驱动错误,其他错误原样返回,不改变正常查询行为。新增的 TestMySQLTelemetryMissingAdapterGuidance 用临时表构造缺列场景,断言了 1054 仍可通过 errors.As 取出、提示里包含列名和迁移脚本,并验证执行 001 脚本后过滤查询恢复正常,断言是实质性的。

非阻塞建议:(1) 该测试依赖 AGENTFLOW_TEST_MYSQL_DSN,默认 CI 会跳过;目前这个 head 上只有开源扫描一项检查,建议维护者触发完整 CI 后再合入。(2) #201 提到同一份 001 脚本还提供 run_logs.level,按日志级别过滤时缺列也会报同样的原始 1054,可以在后续 PR 中用同样方式补上。(3) 测试文件的 patch 在 prepared schema 子测试之后被截断,后半部分没有看全。

@Robert0622

Copy link
Copy Markdown
Collaborator

LoopForge PR Review Bot — reviewed commit c75ccfdf12fbb35f7d219fd98aa280ad4a8a3695

Verdict: PASS ✅

What I checked

  • Diff: 2 files, +104/-0 (internal/repo/runs.go, internal/repo/run_telemetry_mysql_test.go), scoped to the MySQL 1054 "missing adapter column" diagnostic described in the PR.
  • go build ./internal/... ./cmd/... — OK
  • go vet ./internal/repo/... — OK
  • go test ./internal/repo/... — all PASS (10.0s). The new TestMySQLTelemetryMissingAdapterGuidance is skipped in this sandbox because it requires AGENTFLOW_TEST_MYSQL_DSN (no MySQL instance available here); treat this as "not run locally", not a failure.
  • GitHub required check GITHUB_OPENSOURCE_SCAN_PIPELINE@PULL_REQUEST: success. One approving review on file (Yanami-2K).

Note (not a blocker): mergeable_state is currently blocked. There is no failing/pending status check and no merge conflict (0 commits behind main), so this looks like a branch-protection requirement (e.g. an additional required approval) rather than a code issue — worth a maintainer glance before merge.

No further action needed from the author for this version.

This branch has not been deployed

No deployments
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.

3 participants