chore: remove code unreachable on every supported platform#706
chore: remove code unreachable on every supported platform#706euxaristia wants to merge 6 commits into
Conversation
c600ef2 to
1c9d7f4
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughThe change removes production convenience APIs and redundant wrappers, relocates selected helpers into test seams, standardizes tests on scoped tools, updates truncation reporting, consolidates sandbox and TUI paths, and removes the reasoning catalog. ChangesAPI consolidation and test seams
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/config/export_test.go`:
- Around line 21-34: Update the ValidateFile comment to remove the incorrect
claim that callers can use errors.As on returned Issue messages. In the JSON
unmarshal failure branch of ValidateFile, replace fmt.Errorf with fmt.Sprintf
and use %v so the formatting matches the string-only Issue.Message API without
implying error wrapping.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 53c03e2d-b5b2-4373-9e76-d480400759c0
📒 Files selected for processing (139)
internal/acp/agent.gointernal/acp/export_test.gointernal/acp/types.gointernal/agent/additional_permissions_validation_test.gointernal/agent/command_prefix.gointernal/agent/compaction_preserve.gointernal/agent/compaction_test.gointernal/agent/deferred_loop_test.gointernal/agent/denial_test.gointernal/agent/export_test.gointernal/agent/guardrails_test.gointernal/agent/loop.gointernal/agent/loop_test.gointernal/agent/partition_cache_stable_test.gointernal/agent/request_permissions_test.gointernal/agent/types.gointernal/agenteval/agent_command.gointernal/agenteval/export_test.gointernal/config/export_test.gointernal/config/types.gointernal/config/validate.gointernal/config/writer.gointernal/contextreport/contextreport_test.gointernal/cron/export_test.gointernal/cron/schedule.gointernal/dictation/dictation.gointernal/lsp/export_test.gointernal/lsp/registry.gointernal/mcp/registry_test.gointernal/modelregistry/export_test.gointernal/modelregistry/modelsdev.gointernal/modelregistry/modes.gointernal/notify/export_test.gointernal/notify/notify.gointernal/providercatalog/catalog.gointernal/providercatalog/export_test.gointernal/providers/openai/codex.gointernal/providers/openai/export_test.gointernal/providers/openai/provider_test.gointernal/providers/providerio/export_test.gointernal/providers/providerio/providerio.gointernal/reasoning/capability.gointernal/reasoning/catalog.gointernal/reasoning/catalog_test.gointernal/reasoning/modelsdev_snapshot.jsoninternal/reltime/reltime.gointernal/repomap/export_test.gointernal/repomap/repomap.gointernal/review/export_test.gointernal/review/review.gointernal/sandbox/export_test.gointernal/sandbox/grants.gointernal/sandbox/profile.gointernal/sandbox/runner.gointernal/sandbox/windows_setup.gointernal/sessions/checkpoint.gointernal/sessions/export_test.gointernal/sessions/replay.gointernal/skills/export_test.gointernal/skills/install.gointernal/skills/skills.gointernal/specialist/export_test.gointernal/specialist/manifest_test.gointernal/specialist/output_tool.gointernal/specialist/stop_tool.gointernal/specialist/streamer.gointernal/streamjson/export_test.gointernal/streamjson/streamjson.gointernal/tools/apply_patch.gointernal/tools/argtolerance_test.gointernal/tools/ask_user_test.gointernal/tools/bash.gointernal/tools/bash_auto_allow_test.gointernal/tools/bash_tool_test.gointernal/tools/builtin_catalog.gointernal/tools/deferred.gointernal/tools/edit_file.gointernal/tools/edit_replacers_test.gointernal/tools/exec_command.gointernal/tools/export_test.gointernal/tools/file_safety_test.gointernal/tools/file_tools_test.gointernal/tools/format_on_write_test.gointernal/tools/glob.gointernal/tools/grep.gointernal/tools/inline_diagnostics_test.gointernal/tools/list_directory.gointernal/tools/lsp_navigate.gointernal/tools/lsp_navigate_test.gointernal/tools/output_ceiling_test.gointernal/tools/read_exclusions_test.gointernal/tools/read_file.gointernal/tools/read_minified_file.gointernal/tools/read_minified_file_test.gointernal/tools/registry.gointernal/tools/registry_test.gointernal/tools/sandbox_denial.gointernal/tools/search_cancellation_test.gointernal/tools/spill_hardening_test.gointernal/tools/tool_io_bench_test.gointernal/tools/web_fetch.gointernal/tools/write_file.gointernal/tools/write_tools_test.gointernal/trace/emit.gointernal/trace/export_test.gointernal/trace/trace.gointernal/tui/assistant_markdown.gointernal/tui/autocomplete.gointernal/tui/command_polish_test.gointernal/tui/commands.gointernal/tui/export_test.gointernal/tui/image_attach.gointernal/tui/model.gointernal/tui/model_test.gointernal/tui/mouse.gointernal/tui/plan_panel.gointernal/tui/pr_status.gointernal/tui/render_cache.gointernal/tui/selectable_list.gointernal/tui/session_test.gointernal/tui/spec_mode_test.gointernal/tui/specialist_card.gointernal/tui/startup.gointernal/tui/streaming_decoder.gointernal/tui/streaming_fade.gointernal/tui/stt_model_picker.gointernal/tui/tool_render_registry.gointernal/tui/transcript_selection.gointernal/tui/transcript_viewport.gointernal/update/export_test.gointernal/update/update.gointernal/verify/export_test.gointernal/verify/verify.gointernal/workspaceindex/workspaceindex.gointernal/zerocommands/backend_snapshots.gointernal/zerocommands/contracts.gointernal/zerocommands/export_test.gointernal/zeroruntime/finish_reason_test.gointernal/zeroruntime/helpers.go
💤 Files with no reviewable changes (79)
- internal/reasoning/modelsdev_snapshot.json
- internal/sandbox/windows_setup.go
- internal/tools/glob.go
- internal/acp/agent.go
- internal/sandbox/profile.go
- internal/tools/sandbox_denial.go
- internal/tui/transcript_viewport.go
- internal/zerocommands/contracts.go
- internal/tui/startup.go
- internal/tools/write_file.go
- internal/reasoning/catalog.go
- internal/modelregistry/modelsdev.go
- internal/zeroruntime/helpers.go
- internal/cron/schedule.go
- internal/sandbox/grants.go
- internal/reasoning/capability.go
- internal/tools/edit_file.go
- internal/tools/bash.go
- internal/config/types.go
- internal/reltime/reltime.go
- internal/review/review.go
- internal/tools/read_file.go
- internal/specialist/stop_tool.go
- internal/tui/mouse.go
- internal/verify/verify.go
- internal/tui/render_cache.go
- internal/dictation/dictation.go
- internal/specialist/output_tool.go
- internal/workspaceindex/workspaceindex.go
- internal/sessions/checkpoint.go
- internal/tui/stt_model_picker.go
- internal/tools/lsp_navigate.go
- internal/tools/apply_patch.go
- internal/tools/read_minified_file.go
- internal/sessions/replay.go
- internal/zeroruntime/finish_reason_test.go
- internal/agent/command_prefix.go
- internal/reasoning/catalog_test.go
- internal/lsp/registry.go
- internal/tools/web_fetch.go
- internal/notify/notify.go
- internal/tools/list_directory.go
- internal/agenteval/agent_command.go
- internal/providers/providerio/providerio.go
- internal/tui/streaming_fade.go
- internal/tui/specialist_card.go
- internal/tui/streaming_decoder.go
- internal/modelregistry/modes.go
- internal/acp/types.go
- internal/tui/pr_status.go
- internal/streamjson/streamjson.go
- internal/tools/exec_command.go
- internal/config/writer.go
- internal/tui/assistant_markdown.go
- internal/agent/loop.go
- internal/tools/grep.go
- internal/specialist/streamer.go
- internal/agent/compaction_preserve.go
- internal/repomap/repomap.go
- internal/agent/types.go
- internal/tui/plan_panel.go
- internal/skills/skills.go
- internal/providercatalog/catalog.go
- internal/tui/image_attach.go
- internal/update/update.go
- internal/zerocommands/backend_snapshots.go
- internal/tui/tool_render_registry.go
- internal/tui/commands.go
- internal/tui/autocomplete.go
- internal/providers/openai/codex.go
- internal/tui/transcript_selection.go
- internal/config/validate.go
- internal/tui/model.go
- internal/sandbox/runner.go
- internal/skills/install.go
- internal/tools/deferred.go
- internal/tools/registry.go
- internal/tui/selectable_list.go
- internal/trace/emit.go
There was a problem hiding this comment.
Approve. Cross-built go build ./... + go vet ./... (which compiles the tests too) under GOOS=windows/linux/darwin all clean and go test ./... on Windows passes apart from the two usual pre-existing env failures (the symlink-privilege one and the alt-screen TUI render, both fail identically on main). The 3-GOOS union is actually the full platform surface here since the repo has no GOARCH build tags, and the four renames are genuine behavior-preserving inlines (CoreReadOnlyTools was literally return CoreReadOnlyToolsScoped(root, nil) on main, same for the other three), and internal/reasoning is gone with no leftover importers.
One optional, non-blocking nit: the ValidateFile doc comment in internal/config/export_test.go claims callers can errors.As the JSON parse errors out of the returned Issue, but Issue.Message is a plain string and the parse branch flattens the wrapped error via .Error(), so there's no chain to unwrap. That's pre-existing the PR moved it verbatim from validate.go so a separate one-liner is fine, or fold in CodeRabbit's fmt.Sprintf("%v", err) if you'd rather handle it here.
jatmn
left a comment
There was a problem hiding this comment.
I found issues that need to be addressed before this is ready.
Findings
-
[P2] Rebase this head onto current
mainbefore resolving the code review
The PR head is based on9043bae, while currentmainis18cce35; GitHub reports it asCONFLICTING, and a merge-tree check conflicts in the core tool/output paths (bash,exec_command, file tools, and trace emission). The unresolved merge would either prevent merging or require a manual resolution that determines whether recently merged behavior is retained. Please rebase, keep the current-main behavior, and request a review of the resulting diff. -
[P1] Do not roll the published release metadata back to 0.3.0
.release-please-manifest.json:1,package.json:3, andpackage-lock.json:3
The base is the already-releasedv0.4.0, but this cleanup resets all package/release state to0.3.0and deletes the 0.4.0 changelog entry. Release Please and the npm packaging workflow consume these values, so the next release would be calculated from stale history and can try to publish an already-existing version. Keep the 0.4.0 release artifacts when rebasing. -
[P1] Restore the capability gate before batching read tools
internal/agent/parallel_tools.go:35
parallelSafeToolCallnow admits everySideEffectReadtool, but the removed gate requiredThreadSafecapability and rejected conflicting resource keys. This is not just conservative metadata:read_fileexplicitly declaresThreadSafe: falsebecause it updates the file tracker, and plugin/read tools can be stateful too. Two consecutive read calls are therefore launched concurrently despite declaring that they are not safe to do so, which can race shared state or break same-resource ordering. Reinstate the thread-safety and resource-conflict checks (or leave these calls serialized). -
[P1] Reapply the output budget after after-tool hooks append feedback
internal/agent/loop.go:1293
The registry has already applied its redaction/output ceiling whendispatchAfterToolreturns, but this path appends hook feedback and no longer callsRebudgetAfterHook. A verbose formatter, linter, or test hook can consequently append an unbounded multi-megabyte result directly to the model transcript, bypassing both the normal ceiling and the tool-specificmax_output_tokensbudget. Cap/redact the combined result again after appending hook output. -
[P1] Preserve the original tool-truncation bit in machine output
internal/cli/exec_writer.go:169
The PR removesagent.ToolResult.Truncated, so stream JSON now setstruncatedsolely from its own 1 MiB serialization cutoff. Aread_file/search/command result that was already truncated by the tool but is smaller than that cutoff is emitted astruncated: false(and JSON mode omits the field), making automation treat partial output as complete. Carry the tool-level flag through the agent result and OR it with the stream-layer truncation. -
[P1] Keep the strengthened benchmark correctness oracles
internal/perfbench/turn_bench.go:580
This removes the v3 oracle stamping and captured-answer verification, downgrades navigation tasks to latency-only, and changes refactors back to a non-positivego buildcheck. In particular, an agent can leave a refactor untouched and still satisfy the build command, so the published benchmark no longer measures the requested transformation or preserves comparable correctness rates. Retain the current-main v3 fixture/oracle setup rather than deleting it in this cleanup. -
[P3] Correct the moved
ValidateFiledocumentation
internal/config/export_test.go:21
The unresolved CodeRabbit comment is valid:ValidateFilereturns[]Issuewith a stringMessage, after calling.Error()on the wrapped JSON error, so callers cannot useerrors.Asto recover*json.SyntaxErroror*json.UnmarshalTypeError. Remove that claim (and usefmt.Sprintf(...%v...)instead of a discarded%wwrapper) so the exported test seam does not promise an impossible API. -
[P3] Remove the extra trailing blank line
internal/trace/trace.go:271
This adds a blank line at end of file (git diff --checkreports it), which fails the repository's formatting gate. Remove the extra line so the required smoke/format check can pass.
1c9d7f4 to
c4fabe7
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
internal/agent/loop.go (1)
237-242: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove duplicated comment block.
It looks like the copy-paste monster struck here! The comment block explaining the tool list partitioning is repeated twice in a row. Let's zap the duplicate to keep things tidy.
🧹 Proposed fix
- // Build the per-turn tool list first so proactive compaction can include - // the tool-definition tokens (they ride on every request) in its estimate. - // partitionTools depends only on registry/permissions/options/loaded, not on - // the messages, so computing it before compaction is safe. toolPartitionSpan := options.Trace.Span(trace.SpanToolPartition) exposed, _ := partitionToolsCached(registry, permissionMode, options, loaded, toolDefCache)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/agent/loop.go` around lines 237 - 242, Remove the duplicated explanatory comment block immediately before the tool partitioning code in the current loop, keeping one copy that documents why partitionToolsCached is computed before compaction. Leave toolPartitionSpan and partitionToolsCached unchanged.internal/tools/file_tools_test.go (1)
14-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSplit tests into files corresponding to the source files they test.
As per coding guidelines, Go tests should be kept next to the source file they test (e.g.,
foo_test.gonext tofoo.go). Since this file bundles tests for multiple tools likeread_file.go,list_directory.go,glob.go,grep.go, andwrite_file.go, consider splitting it intoread_file_test.go,list_directory_test.go, etc., to improve maintainability.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/tools/file_tools_test.go` around lines 14 - 39, Split the tests in internal/tools/file_tools_test.go into source-specific test files: move read-file tests such as TestReadFileToolReadsLineRanges next to read_file.go, and similarly move list-directory, glob, grep, and write-file tests into list_directory_test.go, glob_test.go, grep_test.go, and write_file_test.go. Preserve each test’s behavior and shared package setup.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/agent/loop.go`:
- Around line 237-242: Remove the duplicated explanatory comment block
immediately before the tool partitioning code in the current loop, keeping one
copy that documents why partitionToolsCached is computed before compaction.
Leave toolPartitionSpan and partitionToolsCached unchanged.
In `@internal/tools/file_tools_test.go`:
- Around line 14-39: Split the tests in internal/tools/file_tools_test.go into
source-specific test files: move read-file tests such as
TestReadFileToolReadsLineRanges next to read_file.go, and similarly move
list-directory, glob, grep, and write-file tests into list_directory_test.go,
glob_test.go, grep_test.go, and write_file_test.go. Preserve each test’s
behavior and shared package setup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0d9256be-0e54-4ec8-837f-0fa19a62eb7d
📒 Files selected for processing (133)
internal/acp/agent.gointernal/acp/export_test.gointernal/acp/types.gointernal/agent/additional_permissions_validation_test.gointernal/agent/command_prefix.gointernal/agent/compaction_preserve.gointernal/agent/compaction_test.gointernal/agent/deferred_loop_test.gointernal/agent/denial_test.gointernal/agent/export_test.gointernal/agent/guardrails_test.gointernal/agent/loop.gointernal/agent/loop_test.gointernal/agent/partition_cache_stable_test.gointernal/agent/request_permissions_test.gointernal/agent/types.gointernal/agenteval/agent_command.gointernal/agenteval/export_test.gointernal/config/export_test.gointernal/config/types.gointernal/config/validate.gointernal/config/writer.gointernal/contextreport/contextreport_test.gointernal/cron/export_test.gointernal/cron/schedule.gointernal/dictation/dictation.gointernal/lsp/export_test.gointernal/lsp/registry.gointernal/mcp/registry_test.gointernal/modelregistry/export_test.gointernal/modelregistry/modelsdev.gointernal/modelregistry/modes.gointernal/notify/export_test.gointernal/notify/notify.gointernal/providercatalog/catalog.gointernal/providercatalog/export_test.gointernal/providers/openai/codex.gointernal/providers/openai/export_test.gointernal/providers/openai/provider_test.gointernal/providers/providerio/export_test.gointernal/providers/providerio/providerio.gointernal/reasoning/capability.gointernal/reasoning/catalog.gointernal/reasoning/catalog_test.gointernal/reasoning/modelsdev_snapshot.jsoninternal/reltime/reltime.gointernal/repomap/export_test.gointernal/repomap/repomap.gointernal/review/export_test.gointernal/review/review.gointernal/sandbox/export_test.gointernal/sandbox/grants.gointernal/sandbox/profile.gointernal/sandbox/runner.gointernal/sandbox/windows_setup.gointernal/sessions/checkpoint.gointernal/sessions/export_test.gointernal/sessions/replay.gointernal/skills/export_test.gointernal/skills/install.gointernal/skills/skills.gointernal/specialist/export_test.gointernal/specialist/manifest_test.gointernal/specialist/output_tool.gointernal/specialist/stop_tool.gointernal/specialist/streamer.gointernal/streamjson/export_test.gointernal/streamjson/streamjson.gointernal/tools/apply_patch.gointernal/tools/argtolerance_test.gointernal/tools/ask_user_test.gointernal/tools/bash.gointernal/tools/bash_auto_allow_test.gointernal/tools/bash_tool_test.gointernal/tools/builtin_catalog.gointernal/tools/deferred.gointernal/tools/edit_file.gointernal/tools/edit_replacers_test.gointernal/tools/exec_command.gointernal/tools/export_test.gointernal/tools/file_safety_test.gointernal/tools/file_tools_test.gointernal/tools/format_on_write_test.gointernal/tools/inline_diagnostics_test.gointernal/tools/lsp_navigate.gointernal/tools/lsp_navigate_test.gointernal/tools/read_exclusions_test.gointernal/tools/read_minified_file_test.gointernal/tools/registry.gointernal/tools/registry_test.gointernal/tools/sandbox_denial.gointernal/tools/search_cancellation_test.gointernal/tools/spill_hardening_test.gointernal/tools/tool_io_bench_test.gointernal/tools/web_fetch.gointernal/tools/write_file.gointernal/tools/write_tools_test.gointernal/trace/emit.gointernal/trace/export_test.gointernal/trace/trace.gointernal/tui/assistant_markdown.gointernal/tui/autocomplete.gointernal/tui/command_polish_test.gointernal/tui/commands.gointernal/tui/export_test.gointernal/tui/image_attach.gointernal/tui/model.gointernal/tui/model_test.gointernal/tui/mouse.gointernal/tui/plan_panel.gointernal/tui/pr_status.gointernal/tui/render_cache.gointernal/tui/selectable_list.gointernal/tui/session_test.gointernal/tui/spec_mode_test.gointernal/tui/specialist_card.gointernal/tui/startup.gointernal/tui/streaming_decoder.gointernal/tui/streaming_fade.gointernal/tui/stt_model_picker.gointernal/tui/tool_render_registry.gointernal/tui/transcript_selection.gointernal/tui/transcript_viewport.gointernal/update/export_test.gointernal/update/update.gointernal/verify/export_test.gointernal/verify/verify.gointernal/workspaceindex/workspaceindex.gointernal/zerocommands/backend_snapshots.gointernal/zerocommands/contracts.gointernal/zerocommands/export_test.gointernal/zeroruntime/finish_reason_test.gointernal/zeroruntime/helpers.go
💤 Files with no reviewable changes (67)
- internal/sandbox/profile.go
- internal/repomap/repomap.go
- internal/zeroruntime/finish_reason_test.go
- internal/sandbox/grants.go
- internal/reasoning/modelsdev_snapshot.json
- internal/tools/edit_file.go
- internal/modelregistry/modes.go
- internal/tools/write_file.go
- internal/tools/sandbox_denial.go
- internal/acp/types.go
- internal/specialist/output_tool.go
- internal/review/review.go
- internal/cron/schedule.go
- internal/dictation/dictation.go
- internal/reltime/reltime.go
- internal/notify/notify.go
- internal/tools/apply_patch.go
- internal/providers/openai/codex.go
- internal/sandbox/windows_setup.go
- internal/specialist/stop_tool.go
- internal/tui/transcript_viewport.go
- internal/tui/streaming_decoder.go
- internal/sessions/checkpoint.go
- internal/config/writer.go
- internal/verify/verify.go
- internal/lsp/registry.go
- internal/reasoning/capability.go
- internal/sessions/replay.go
- internal/providercatalog/catalog.go
- internal/zerocommands/contracts.go
- internal/acp/agent.go
- internal/agenteval/agent_command.go
- internal/tui/stt_model_picker.go
- internal/tui/selectable_list.go
- internal/tui/startup.go
- internal/reasoning/catalog.go
- internal/tui/streaming_fade.go
- internal/tui/specialist_card.go
- internal/agent/compaction_preserve.go
- internal/tui/tool_render_registry.go
- internal/providers/providerio/providerio.go
- internal/tui/pr_status.go
- internal/zeroruntime/helpers.go
- internal/workspaceindex/workspaceindex.go
- internal/reasoning/catalog_test.go
- internal/streamjson/streamjson.go
- internal/tui/render_cache.go
- internal/update/update.go
- internal/specialist/streamer.go
- internal/tui/mouse.go
- internal/config/types.go
- internal/config/validate.go
- internal/zerocommands/backend_snapshots.go
- internal/tools/lsp_navigate.go
- internal/tui/image_attach.go
- internal/tui/assistant_markdown.go
- internal/tui/commands.go
- internal/agent/command_prefix.go
- internal/tui/plan_panel.go
- internal/sandbox/runner.go
- internal/skills/install.go
- internal/skills/skills.go
- internal/tui/model.go
- internal/tui/autocomplete.go
- internal/tui/transcript_selection.go
- internal/tools/deferred.go
- internal/modelregistry/modelsdev.go
🚧 Files skipped from review as they are similar to previous changes (61)
- internal/review/export_test.go
- internal/agent/partition_cache_stable_test.go
- internal/providers/openai/export_test.go
- internal/agenteval/export_test.go
- internal/providers/providerio/export_test.go
- internal/notify/export_test.go
- internal/tools/read_minified_file_test.go
- internal/cron/export_test.go
- internal/tools/inline_diagnostics_test.go
- internal/streamjson/export_test.go
- internal/tools/file_safety_test.go
- internal/lsp/export_test.go
- internal/tui/spec_mode_test.go
- internal/providercatalog/export_test.go
- internal/acp/export_test.go
- internal/tools/edit_replacers_test.go
- internal/agent/request_permissions_test.go
- internal/tools/lsp_navigate_test.go
- internal/tools/ask_user_test.go
- internal/tools/spill_hardening_test.go
- internal/agent/denial_test.go
- internal/tools/builtin_catalog.go
- internal/specialist/manifest_test.go
- internal/agent/types.go
- internal/specialist/export_test.go
- internal/tools/tool_io_bench_test.go
- internal/trace/trace.go
- internal/skills/export_test.go
- internal/providers/openai/provider_test.go
- internal/contextreport/contextreport_test.go
- internal/repomap/export_test.go
- internal/agent/additional_permissions_validation_test.go
- internal/tui/model_test.go
- internal/agent/compaction_test.go
- internal/mcp/registry_test.go
- internal/tools/web_fetch.go
- internal/trace/export_test.go
- internal/zerocommands/export_test.go
- internal/sessions/export_test.go
- internal/agent/export_test.go
- internal/tools/read_exclusions_test.go
- internal/tui/command_polish_test.go
- internal/tools/format_on_write_test.go
- internal/tools/bash_auto_allow_test.go
- internal/tui/session_test.go
- internal/tools/search_cancellation_test.go
- internal/tools/registry_test.go
- internal/config/export_test.go
- internal/agent/deferred_loop_test.go
- internal/verify/export_test.go
- internal/tools/registry.go
- internal/modelregistry/export_test.go
- internal/sandbox/export_test.go
- internal/tools/argtolerance_test.go
- internal/trace/emit.go
- internal/tools/write_tools_test.go
- internal/tools/export_test.go
- internal/tui/export_test.go
- internal/tools/bash_tool_test.go
- internal/agent/loop_test.go
- internal/update/export_test.go
Vasanthdev2004
left a comment
There was a problem hiding this comment.
Really close now. The rebase onto current main resolved everything heavy from the last round — the release metadata rollback, the parallel-tools gate, the hook rebudgeting path, and the bench oracles are all out of the diff, and the ValidateFile doc fix landed and reads right. One thing left: the ubuntu smoke job is red because gofmt flags internal/trace/trace.go — the PR still adds a stray blank line at the end of that file (jatmn caught this last round too). Delete that one line and push, and this gets my approve.
jatmn
left a comment
There was a problem hiding this comment.
I found issues that need to be addressed before this is ready.
Findings
-
[P1] Restore Go formatting before merging
internal/trace/trace.go:287
The extra blank line at EOF makesgofmt -l .report this file, which is why the required Ubuntu Smoke job fails at “Check formatting” and skips its Linux vet, test, build, and smoke stages. Remove the trailing blank line (or rungofmt) so the required gate can run. -
[P2] Keep the exported trace adapters implementing their documented contract
internal/trace/emit.go:10-16,141-145
This leavesSink,NDJSONSink, andTextSinkexported and documented as writer-backed sinks, but removes bothEmitmethods;TextSinkalso loses its only production emitter whenWriteTextmoves to_test.go. Consequently, an in-module consumer such asvar s trace.Sink = trace.NDJSONSink{W: w}no longer compiles, andTextSinkcannot emit a trace at all. Retain the methods (andWriteTextfor the text adapter), or remove/update these obsolete exported types and their contract together. -
[P2] Update skills documentation that references removed APIs
internal/skills/skills.go:42,138,142,243
DiscoveryRootsandDuplicatesnow exist only inexport_test.go, yet the retained package documentation anddocs/HOW_ZERO_WORKS.mddirect discovery callers to those production helpers. A contributor following that documented API gets an undefined-symbol compile error. Replace those references with the retained production entry points (or keep compatible wrappers) as part of this removal.
|
Pushed f616b82 addressing the remaining findings: the stray blank line at EOF of internal/trace/trace.go is gone (gofmt clean), and the orphaned exported adapters are resolved by removal — Sink, NDJSONSink, and TextSink had lost their Emit methods and had no implementers or callers left, so the types go with their contract (consistent with this PR's purpose). Skills package docs and HOW_ZERO_WORKS.md no longer direct callers to DiscoveryRoots/Duplicates, which are now test seams; they point at LoadFromRoots instead. |
|
Pushed 8e110f5. Fixed:
Not fixing, with reason:
|
Vasanthdev2004
left a comment
There was a problem hiding this comment.
Re-verified on the current head. My one blocker is gone: the stray trailing blank line in internal/trace/trace.go that was failing gofmt on the ubuntu smoke job. trace.go isn't touched by the PR anymore, it ends cleanly, and CI is green across every job including Security & code health and all three Smoke platforms. The optional ValidateFile doc nit from the earlier round got folded in too. Clean dead-code removal. Approving.
|
@jatmn Ready for re-review. Your last note was LGTM; that review was dismissed by a later push. Current head is green on Smoke (all three OS), Security, and Zero Review, with @Vasanthdev2004 approval. Please take another look when you can. |
|
hello @euxaristia please rebase to main and fix conflicts |
8e110f5 to
b9fbbb6
Compare
|
Rebased onto main to resolve a conflict in internal/trace/emit.go. Since this branch diverged, main added a task_state summary line to WriteText. This PR moves WriteText out of production code into internal/trace/export_test.go (it's only referenced by tests). I ported the new task_state block into that moved copy so the feature isn't lost. Verified after rebase: go build ./..., go vet ./..., and go test ./... all pass. |
b9fbbb6 to
fe14cf9
Compare
|
Addressed the latest CHANGES_REQUESTED findings and rebased onto current main. Fixed:
Also rebased onto Verified: |
jatmn
left a comment
There was a problem hiding this comment.
I found issues that need to be addressed before this is ready.
Findings
-
[P3] Remove the reference to the deleted truncation helper
internal/zeroruntime/helpers.go:16-19
CollectedStream.Truncated()is deleted in this change, but theFinishReasonfield comment still tells callers thatTruncatedreports whether it is set. That documents a nonexistent API and sends future callers/tests toward a compile failure. Update the comment to say callers should inspectFinishReasondirectly. -
[P3] Correct the deferred-MCP helper documentation after moving
DeferredLineto test-only code
internal/tools/deferred.go:40-45
The production comment saysmcpServerNamedis consumed byDeferredLine, butDeferredLinenow exists only inexport_test.go; production discovery usesDeferredSource. This leaves the retained production source documenting an unavailable helper. NameDeferredSourcehere, and mark the copiedDeferredLinecomment as a test seam rather than claiming the agent loop uses it.
fe14cf9 to
5ab9095
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/tools/bash_tool_test.go (1)
354-371: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winUse the scoped constructor in this new regression test.
Line 359 retains a direct dependency on
NewBashTool, keeping the legacy production wrapper reachable and preventing its removal with the rest of this migration.Proposed fix
- result := NewBashTool(root).Run(context.Background(), map[string]any{ + result := NewScopedBashTool(root, nil).Run(context.Background(), map[string]any{🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/tools/bash_tool_test.go` around lines 354 - 371, Update TestBashToolReportsWorkspaceChangesAfterFailure to construct the tool through the scoped constructor used by the migrated tests instead of NewBashTool. Preserve the existing command, failure assertions, and change-reporting checks while removing this test’s dependency on the legacy production wrapper.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/tools/export_test.go`:
- Around line 133-142: Remove the invalid len method on execSessionManager and
the likelySandboxDenied helper from internal/tools/export_test.go. Update any
callers to use the current execution.ProcessManager API and the package’s
available sandbox-denial behavior, or delete the associated test paths when no
replacement exists; do not reference inaccessible mu/sessions fields or
undefined sandboxDenialKind.
---
Outside diff comments:
In `@internal/tools/bash_tool_test.go`:
- Around line 354-371: Update TestBashToolReportsWorkspaceChangesAfterFailure to
construct the tool through the scoped constructor used by the migrated tests
instead of NewBashTool. Preserve the existing command, failure assertions, and
change-reporting checks while removing this test’s dependency on the legacy
production wrapper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 456390d5-6b71-4b64-92b5-b473df1c6b72
📒 Files selected for processing (132)
docs/HOW_ZERO_WORKS.mdinternal/acp/agent.gointernal/acp/export_test.gointernal/acp/types.gointernal/agent/additional_permissions_validation_test.gointernal/agent/command_prefix.gointernal/agent/compaction_preserve.gointernal/agent/compaction_test.gointernal/agent/deferred_loop_test.gointernal/agent/denial_test.gointernal/agent/export_test.gointernal/agent/guardrails_test.gointernal/agent/loop.gointernal/agent/loop_test.gointernal/agent/partition_cache_stable_test.gointernal/agent/request_permissions_test.gointernal/agent/types.gointernal/agenteval/agent_command.gointernal/agenteval/export_test.gointernal/config/export_test.gointernal/config/types.gointernal/config/validate.gointernal/config/writer.gointernal/contextreport/contextreport_test.gointernal/cron/export_test.gointernal/cron/schedule.gointernal/dictation/dictation.gointernal/lsp/export_test.gointernal/lsp/registry.gointernal/mcp/registry_test.gointernal/modelregistry/export_test.gointernal/modelregistry/modelsdev.gointernal/modelregistry/modes.gointernal/notify/export_test.gointernal/notify/notify.gointernal/plugins/activate.gointernal/providercatalog/catalog.gointernal/providercatalog/export_test.gointernal/providers/openai/codex.gointernal/providers/openai/export_test.gointernal/providers/openai/provider_test.gointernal/providers/providerio/export_test.gointernal/providers/providerio/providerio.gointernal/reasoning/capability.gointernal/reasoning/catalog.gointernal/reasoning/catalog_test.gointernal/reasoning/modelsdev_snapshot.jsoninternal/reltime/reltime.gointernal/repomap/export_test.gointernal/repomap/repomap.gointernal/review/export_test.gointernal/review/review.gointernal/sandbox/export_test.gointernal/sandbox/grants.gointernal/sandbox/profile.gointernal/sandbox/runner.gointernal/sandbox/windows_setup.gointernal/sessions/checkpoint.gointernal/sessions/export_test.gointernal/sessions/replay.gointernal/skills/export_test.gointernal/skills/install.gointernal/skills/skills.gointernal/specialist/export_test.gointernal/specialist/manifest_test.gointernal/specialist/output_tool.gointernal/specialist/stop_tool.gointernal/specialist/streamer.gointernal/streamjson/export_test.gointernal/streamjson/streamjson.gointernal/tools/apply_patch.gointernal/tools/argtolerance_test.gointernal/tools/ask_user_test.gointernal/tools/bash.gointernal/tools/bash_auto_allow_test.gointernal/tools/bash_tool_test.gointernal/tools/builtin_catalog.gointernal/tools/deferred.gointernal/tools/edit_file.gointernal/tools/edit_replacers_test.gointernal/tools/export_test.gointernal/tools/file_safety_test.gointernal/tools/file_tools_test.gointernal/tools/format_on_write_test.gointernal/tools/inline_diagnostics_test.gointernal/tools/lsp_navigate.gointernal/tools/lsp_navigate_test.gointernal/tools/read_exclusions_test.gointernal/tools/read_minified_file_test.gointernal/tools/registry.gointernal/tools/registry_test.gointernal/tools/search_cancellation_test.gointernal/tools/spill_hardening_test.gointernal/tools/tool_io_bench_test.gointernal/tools/web_fetch.gointernal/tools/write_file.gointernal/tools/write_tools_test.gointernal/trace/emit.gointernal/trace/export_test.gointernal/tui/assistant_markdown.gointernal/tui/autocomplete.gointernal/tui/command_polish_test.gointernal/tui/commands.gointernal/tui/export_test.gointernal/tui/image_attach.gointernal/tui/model.gointernal/tui/model_test.gointernal/tui/mouse.gointernal/tui/plan_panel.gointernal/tui/pr_status.gointernal/tui/render_cache.gointernal/tui/selectable_list.gointernal/tui/session_test.gointernal/tui/spec_mode_test.gointernal/tui/specialist_card.gointernal/tui/startup.gointernal/tui/streaming_decoder.gointernal/tui/streaming_fade.gointernal/tui/stt_model_picker.gointernal/tui/tool_render_registry.gointernal/tui/transcript_selection.gointernal/tui/transcript_viewport.gointernal/update/export_test.gointernal/update/update.gointernal/verify/export_test.gointernal/verify/verify.gointernal/workspaceindex/workspaceindex.gointernal/zerocommands/backend_snapshots.gointernal/zerocommands/contracts.gointernal/zerocommands/export_test.gointernal/zeroruntime/finish_reason_test.gointernal/zeroruntime/helpers.go
💤 Files with no reviewable changes (61)
- internal/reltime/reltime.go
- internal/agent/command_prefix.go
- internal/streamjson/streamjson.go
- internal/config/writer.go
- internal/tui/streaming_fade.go
- internal/tools/edit_file.go
- internal/sandbox/windows_setup.go
- internal/modelregistry/modelsdev.go
- internal/tui/render_cache.go
- internal/notify/notify.go
- internal/reasoning/catalog.go
- internal/workspaceindex/workspaceindex.go
- internal/agenteval/agent_command.go
- internal/tools/lsp_navigate.go
- internal/sessions/replay.go
- internal/reasoning/modelsdev_snapshot.json
- internal/acp/agent.go
- internal/tools/apply_patch.go
- internal/tui/tool_render_registry.go
- internal/verify/verify.go
- internal/tui/assistant_markdown.go
- internal/tui/startup.go
- internal/review/review.go
- internal/tui/transcript_viewport.go
- internal/providers/providerio/providerio.go
- internal/acp/types.go
- internal/specialist/output_tool.go
- internal/zerocommands/backend_snapshots.go
- internal/lsp/registry.go
- internal/cron/schedule.go
- internal/tui/selectable_list.go
- internal/tui/commands.go
- internal/update/update.go
- internal/modelregistry/modes.go
- internal/tui/plan_panel.go
- internal/zeroruntime/helpers.go
- internal/zerocommands/contracts.go
- internal/reasoning/capability.go
- internal/tui/image_attach.go
- internal/providers/openai/codex.go
- internal/dictation/dictation.go
- internal/providercatalog/catalog.go
- internal/tools/write_file.go
- internal/specialist/streamer.go
- internal/specialist/stop_tool.go
- internal/agent/compaction_preserve.go
- internal/tui/streaming_decoder.go
- internal/reasoning/catalog_test.go
- internal/repomap/repomap.go
- internal/tui/specialist_card.go
- internal/skills/install.go
- internal/config/validate.go
- internal/tools/web_fetch.go
- internal/tui/mouse.go
- internal/tui/stt_model_picker.go
- internal/sessions/checkpoint.go
- internal/tools/deferred.go
- internal/zeroruntime/finish_reason_test.go
- internal/tui/pr_status.go
- internal/tools/registry.go
- internal/tui/autocomplete.go
🚧 Files skipped from review as they are similar to previous changes (66)
- internal/agent/additional_permissions_validation_test.go
- internal/review/export_test.go
- internal/streamjson/export_test.go
- internal/acp/export_test.go
- internal/cron/export_test.go
- internal/sessions/export_test.go
- internal/tui/spec_mode_test.go
- internal/agent/deferred_loop_test.go
- internal/tools/inline_diagnostics_test.go
- internal/notify/export_test.go
- internal/plugins/activate.go
- internal/agent/partition_cache_stable_test.go
- internal/agent/request_permissions_test.go
- internal/zerocommands/export_test.go
- internal/agenteval/export_test.go
- internal/tools/spill_hardening_test.go
- internal/providers/openai/export_test.go
- internal/contextreport/contextreport_test.go
- internal/lsp/export_test.go
- internal/specialist/export_test.go
- internal/verify/export_test.go
- internal/tools/tool_io_bench_test.go
- internal/sandbox/profile.go
- internal/agent/denial_test.go
- internal/sandbox/grants.go
- internal/tools/bash_auto_allow_test.go
- internal/providers/providerio/export_test.go
- internal/tools/edit_replacers_test.go
- internal/tools/format_on_write_test.go
- internal/tools/read_minified_file_test.go
- internal/specialist/manifest_test.go
- internal/agent/types.go
- internal/agent/export_test.go
- internal/tools/lsp_navigate_test.go
- internal/tools/ask_user_test.go
- internal/config/types.go
- internal/agent/compaction_test.go
- internal/modelregistry/export_test.go
- docs/HOW_ZERO_WORKS.md
- internal/tools/file_safety_test.go
- internal/tui/session_test.go
- internal/tools/builtin_catalog.go
- internal/update/export_test.go
- internal/providercatalog/export_test.go
- internal/mcp/registry_test.go
- internal/repomap/export_test.go
- internal/tui/model_test.go
- internal/agent/loop.go
- internal/agent/guardrails_test.go
- internal/tools/registry_test.go
- internal/tui/transcript_selection.go
- internal/config/export_test.go
- internal/providers/openai/provider_test.go
- internal/tools/bash.go
- internal/skills/skills.go
- internal/tools/search_cancellation_test.go
- internal/trace/emit.go
- internal/skills/export_test.go
- internal/tools/read_exclusions_test.go
- internal/trace/export_test.go
- internal/tui/model.go
- internal/sandbox/export_test.go
- internal/tui/export_test.go
- internal/tools/write_tools_test.go
- internal/agent/loop_test.go
- internal/tools/file_tools_test.go
jatmn
left a comment
There was a problem hiding this comment.
I found issues that need to be addressed before this is ready.
Findings
-
[P1] Restore a compilable
internal/toolstest package
internal/tools/export_test.go:133-141
The new test seam tries to add a method toexecSessionManager, which is now an alias forexecution.ProcessManager; Go forbids methods on that non-local type, and the referencedmuandsessionsfields no longer exist. The following helper also calls the removedsandboxDenialKind. As a result,go vet ./...andgo test ./...fail in the Ubuntu, macOS, and Windows smoke jobs. Remove or rewrite these stale helpers against the current process-manager/sandbox APIs so the required checks can run. -
[P3] Update production comments that now direct callers to test-only APIs
internal/zeroruntime/helpers.go:16-19,internal/tools/deferred.go:40-45,internal/config/validate.go:15-20,internal/providers/providerio/providerio.go:198-200,364-367
This move leaves normal-source comments naming helpers that now exist only inexport_test.go:CollectedStream.Truncated,DeferredLine,ValidateFile, andScanSSEData. This is documentation drift rather than a runtime regression, but it points future contributors at APIs unavailable in normal builds. Point the comments at the retained production APIs (FinishReason,DeferredSource,ValidateBytes, and the production SSE scanner) or describe the behavior without naming removed APIs.
|
Rebased onto current upstream main to resolve the conflict from the sandbox unify-command-execution refactor (96859c9). Conflicts were in internal/sandbox/runner.go, internal/tools/exec_command.go, and internal/tools/sandbox_denial.go. In each case the dead code this PR removes had already been superseded by that refactor (moved into export_test.go as a test seam, or replaced outright by the new execution package), so the resolution keeps main's new code and layers this PR's deletions on top of it. Also dropped two stale test seams in internal/tools/export_test.go that referenced symbols the refactor had already deleted. Build is clean and tests match baseline behavior on an unmodified upstream/main checkout. |
|
Follow-up: the rebase push above landed a broken commit. The conflict resolution deleted internal/sandbox/runner.go functions that internal/tools/export_test.go still referenced (execSessionManager.len(), likelySandboxDenied, sandboxDenialKind), and I'd fixed that in my working tree and verified the build locally, but pushed before committing the fix, so the pushed branch didn't include it. Pushed the missing commit (removing the stale export_test.go seams). Branch now builds and go vet passes cleanly on the currently pushed HEAD. |
|
please check bro @Vasanthdev2004 |
The Security and code health job's advisory deadcode step reports 152 unreachable functions on main. Running the same check under GOOS=linux, windows, and darwin shows 13 of those are false positives whose callers live in windows build-tagged files, so only functions unreachable on all three platforms are touched. Functions with no references anywhere are deleted, including the internal/reasoning package, which nothing imports. Functions that only tests reference move into per-package export_test.go files so tests keep their seams while the production binary sheds the code. Test call sites of deleted convenience wrappers are ported to the live APIs (scoped tool constructors, tools.DeferredSource, FinishReason checks). Kept despite the report: cron.Store.Runs (only reader of runs.jsonl, which production writes), and agenteval.TraceEventKeys and MissingTraceEvents (used across packages by the trace contract test).
Message is a flattened string (.Error() already called on the parse error), not a wrapped error, so callers can't recover the concrete json error type via errors.As. Fix the comment to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ferences The dead-code pass removed the Emit methods but left Sink, NDJSONSink, and TextSink exported with a contract nothing implements; remove the types with their contract. Also remove the stray blank line at EOF of trace.go flagged by gofmt, and update skills package docs and HOW_ZERO_WORKS.md to stop directing callers to DiscoveryRoots/Duplicates, which are now test seams. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace a pointless fmt.Errorf(...%w...).Error() with fmt.Sprintf using %v, since the wrapped error was discarded immediately anyway. Remove a comment block that was duplicated verbatim.
Load and MergedSkills comments still named List/Get as production entry points after they moved to export_test.go. Point callers at Load and ListFromRoots instead.
execSessionManager.len() and likelySandboxDenied/sandboxDenialKind had no remaining callers after the sandbox unify-command-execution rebase; the production code they wrapped for tests no longer exists.
|
Rebased onto current upstream main (was 6 commits behind). No conflicts; focused tests for tools/sandbox/skills and |
e8f1a45 to
2c92a55
Compare
Summary
The Security and code health job's advisory deadcode step reports 152 unreachable functions on main. This PR removes everything that is genuinely dead on every supported platform and documents the handful of entries that must stay.
The raw report overcounts. deadcode analyzes one GOOS at a time, and CI runs it on ubuntu, so functions whose only callers sit in windows build-tagged files look unreachable. I ran the same check under GOOS=linux, GOOS=windows, and GOOS=darwin and only touched functions unreachable on all three. That leaves 139 candidates, of which 136 are removed here.
Changes
Kept, with reasons
After this PR the ubuntu deadcode step reports 16 findings: the 13 windows false positives plus the 3 keeps above.
Verification
Summary by CodeRabbit
New Features
Bug Fixes