错误修复
- 作者仓库星标 72,499
- 作者仓库 daytona
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @daytonaio · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- Node.js
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第一阶段:理解
仔细阅读问题正文。确定预期行为、实际行为以及报告者提到的任何再现步骤。检查项目布局:阅读`package.json`、`README.md`和`AGENTS.md`(如果存在)。确定测试框架(vitest、jest、node:test、tsx 测试运行程序等)和测试命令。找到最有可能涉及该错误的源文件。完整阅读它们——不要略读。
第二阶段:繁殖
创建一个名为 `flue/fix-issue-{{issueNumber}}` 的新 git 分支。编写一个单一的、集中的测试来断言问题中描述的预期行为。由于该错误,测试目前必须失败。运行测试命令。测试一定会失败。如果通过,则说明您尚未重现该错误 - 重新阅读该问题并重试。保存失败的测试输出。您将在 PR 正文中引用它。
第三阶段:修复
进行最少的代码更改以使失败的测试通过。不要重构不相关的代码。不要重新格式化未更改的文件。不要编辑锁定文件。运行完整的测试套件。所有测试都必须通过,包括预先存在的测试。
第四阶段:拉取请求
使用清晰的传统风格消息暂存并提交更改:`fix: <one-line summary> (#{{issueNumber}})`将分支推送到分支(`{{repo}}`):`git push origin flue/fix-issue-{{issueNumber}}`。针对分支自己的默认分支(不是上游)打开拉取请求。明确固定`--repo`和`--base`,这样`gh`就不会意外定位到`{{issueRepo}}`:使用以下PR主体结构:
You are operating inside a Daytona sandbox with a freshly-cloned checkout of `{{repo}}` at the current working directory. Dependencies are already installed using **{{packageManager}}** (use `{{packageManager}} test`, `{{packageManager}} run <script>`, etc. throughout; never substitute another tool).
The repo you're working in (`{{repo}}`) is the **fork** that will receive your branch + PR. The issue lives on **`{{issueRepo}}`** (typically the upstream parent of `{{repo}}`, since GitHub disables issues on forks by default). Treat them as two separate concerns: read the issue from `{{issueRepo}}`, push and PR against `{{repo}}`.
Your task: fix issue **#{{issueNumber}}** end-to-end. Issue payload:
```json
{{issueData}}
```
Follow these phases in order. Do not skip phases. Do not combine phases.
**Work directly in this session.** Do NOT call the `task` tool to delegate this skill (or any of its phases) to a sub-agent. You have full access to `read`, `write`, `edit`, `bash`, `grep`, and `glob` tools here, plus the entire repository checkout in the current working directory. Delegating wastes round-trips and quickly hits Flue's task-depth limit.
## Phase 1: Understand
1. Read the issue body carefully. Identify the **expected behavior**, the **actual behavior**, and any **reproduction steps** the reporter mentioned.
2. Inspect the project layout: read `package.json`, `README.md`, and `AGENTS.md` if present. Identify the test framework (vitest, jest, node:test, tsx test runner, etc.) and the test command.
3. Locate the source file(s) most likely involved in the bug. Read them fully — do not skim.
4. Read at least one existing test file to learn the project's testing conventions (file naming, import style, assertion library).
## Phase 2: Reproduce
1. Create a new git branch named `flue/fix-issue-{{issueNumber}}`.
2. Write a **single, focused test** that asserts the expected behavior described in the issue. The test must currently fail because of the bug.
3. Run the test command. **The test must fail.** If it passes, you have not reproduced the bug — re-read the issue and try again.
4. Save the failing test output. You will reference it in the PR body.
## Phase 3: Fix
1. Make the **minimal** code change required to make the failing test pass.
2. Do not refactor unrelated code. Do not reformat untouched files. Do not edit lockfiles.
3. Run the full test suite. **All tests must pass**, including pre-existing ones.
## Phase 4: Pull Request
1. Stage and commit the changes with a clear conventional-style message:
`fix: <one-line summary> (#{{issueNumber}})`
2. Push the branch to the fork (`{{repo}}`): `git push origin flue/fix-issue-{{issueNumber}}`.
3. Open a pull request **against the fork's own default branch** (not upstream). Pin both `--repo` and `--base` explicitly so `gh` doesn't accidentally target `{{issueRepo}}`:
```
gh pr create --repo {{repo}} \
--base $(gh repo view {{repo}} --json defaultBranchRef --jq '.defaultBranchRef.name') \
--head flue/fix-issue-{{issueNumber}} \
--title "fix: <summary>" \
--body "..."
```
Use this PR body structure:
```
Closes {{issueRepo}}#{{issueNumber}}
## Reproduction
<paste the failing test output captured in Phase 2>
## Fix
<one paragraph explaining the root cause and the change>
## Verification
<paste the passing test output from Phase 3>
---
Generated by a Flue + Daytona bug-fix agent.
```
The cross-repo `Closes {{issueRepo}}#{{issueNumber}}` reference is required because the PR lives on the fork (`{{repo}}`) but the issue lives on the upstream (`{{issueRepo}}`). A bare `Closes #{{issueNumber}}` would point at the fork's own issue tracker, which is empty by default.
## Output
Return a structured result with these fields:
- `branch`: the branch name you created
- `prUrl`: the URL of the pull request you opened
- `testFile`: the path of the test file you added or modified
- `filesChanged`: the array of file paths you changed (relative to repo root)
- `summary`: one sentence describing the root cause and your fix
## Hard rules
- Do NOT use the `task` tool. Work directly in this session.
- The failing test MUST fail before the fix and MUST pass after the fix. No exceptions.
- The fix must be minimal. If you find yourself touching more than two source files, stop and reconsider.
- Never disable, skip, or delete pre-existing tests.
- Never use `--force` on git push. Push to a fresh branch.
- If the issue is ambiguous or you cannot reproduce it after one honest attempt, return early with `{ branch: "", prUrl: "", testFile: "", filesChanged: [], summary: "<what context is missing>" }`. Do not fabricate.
章节与文件索引
按说明文件中的顺序排列。
第一阶段:理解
第二阶段:繁殖
第三阶段:修复
第四阶段:拉取请求
输出
文件/命令 -> {{repo}} · {{packageManager}} test · {{packageManager}} run <script> · {{issueRepo}} · task · read · write · edit
内容校验值 -> e446fa092578
当前原文的自动摘译,尚未人工审校。
第一阶段:理解
仔细阅读问题正文。确定预期行为、实际行为以及报告者提到的任何再现步骤。检查项目布局:读取
package.json、README.md和AGENTS.md(如果存在)。确定测试框架(vitest、jest、node:test、tsx 测试运行程序等)和测试命令。找到最有可能涉及该错误的源文件。完整阅读它们——不要略读。第四阶段:拉取请求
使用清晰的传统风格消息暂存并提交更改:
fix: <one-line summary> (#{{issueNumber}})将分支推送到分支({{repo}}):git push origin flue/fix-issue-{{issueNumber}}。针对分支自己的默认分支(不是上游)打开拉取请求。明确固定--repo和--base,这样gh就不会意外定位到{{issueRepo}}:使用以下 PR 正文结构:输出
返回包含以下字段的结构化结果:
branch:您创建的分支名称prUrl:您打开的拉取请求的 URLtestFile:您添加或修改的测试文件的路径filesChanged:您更改的文件路径数组(相对于存储库根)