Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

answer_commit drops requested elements that appear only in `basis`, and loses trailing zeros in numeric cells

未关闭
#1,481 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
sql, typescript
领域
tooling

调研方向

Start in packages/opencode/src/altimate/tools/answer-commit.ts on the feat/analyst-v10-commit branch, where the numeric 15-significant-digit check (about line 31), the rows union schema (about lines 56-61), and the optional precision field (about lines 37-46) live, and where answer_only rendering skips basis. The three defects need separate changes: scale-preserving number rendering, rejection that names missing targets or falls back to basis, and rounding instead of rejecting long floats. Done when the three acceptance unit tests in the issue pass, but the maintainers still need to decide how compound requests are detected.

由索引模型根据 Issue 内容生成。

描述

Problem

Two independent defects in answer_commit (packages/opencode/src/altimate/tools/answer-commit.ts, present on the analyst-commit branches, not yet on main) cause a correct computation to be reported as an incomplete or differently formatted final answer.

  1. Compound requests lose elements. With answer_only: true the basis is never rendered; only fields / rows reach the final output. When a question asks for two things ("the repository and the most frequently copied file"), models commit one field and place the second item only in basis. The second item is silently dropped.
  2. Trailing zeros are lost. Cell values are z.union([z.string(), number, z.null()]) and rendered with String(value). A JSON number 5.00 reaches the tool as JS 5 and renders as 5, next to sibling cells such as 4.18. precision is opt-in, so nothing restores the scale.
  3. Valid numbers are rejected. Numbers with more than 15 significant digits (for example a float32 artefact 18.440000534057617 printed by sql_execute) are rejected until the model re-sends them as strings.

Mechanism

  • Numeric validation: the 15-significant-digit check at about answer-commit.ts:31; rows schema union at about :56-61; precision optional at :37-46 (line numbers from branch feat/analyst-v10-commit).
  • answer_only rendering skips basis, so a requested element that exists only there never reaches the output.

Evidence

Recorded analyst sessions:

  • Compound request: 5 of 5 sessions that used answer_commit committed only the repository field and returned an 18-byte answer, while the same model without the tool answered with both items in all 5 sessions. 4 of the 5 committed the same repository as the correct answers.
  • Trailing zero: in 5 sessions on a question whose answer has averages like 4.18 and 5.00, 3 sessions passed the number 5 and returned an incorrect answer; the 2 that passed the string "5.00" were correct. The source SQL had printed 5.000000 and 5.0.
  • 9 further calls were rejected for passing 15+ significant digit doubles or float32 artefacts.

Impact

Answer-losing: about 8 incorrect answers in the recorded sessions that were otherwise computed correctly. No time or cost effect.

Proposed fix

  • Before rendering with answer_only, compare the number of requested outputs (parse "X and Y", "for each ...") with the committed fields; on mismatch reject with the list of missing targets, or fall back to rendering the basis.
  • Render each numeric column with the maximum decimal scale present in that column (or the source result's scale).
  • Accept numbers with more than 15 significant digits and round to precision instead of rejecting.

Acceptance check

  • Unit test: rows with cells 5 and 4.18 renders 5.00 and 4.18 when the column scale is 2.
  • Unit test: a two-target question committed with one field is rejected naming the missing target (or renders the basis).
  • Unit test: a float32 artefact value is accepted and rounded.

Applies to the answer_commit tool introduced in #1449.

主要语言
TypeScript
星标
810
派生
121
平均合并
1 天 12 小时
30 天内合并 PR
94

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AltimateAI/altimate-code 的其他 Issue

查看 AltimateAI/altimate-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。