Skip to content

chore: remove code unreachable on every supported platform#706

Open
euxaristia wants to merge 6 commits into
Gitlawb:mainfrom
euxaristia:chore/strip-deadcode
Open

chore: remove code unreachable on every supported platform#706
euxaristia wants to merge 6 commits into
Gitlawb:mainfrom
euxaristia:chore/strip-deadcode

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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

  • Deletes 44 functions with no references anywhere, including the internal/reasoning package, which nothing imports.
  • Moves 92 functions that only tests reference into per-package export_test.go files. Tests keep their seams and observation helpers, and the production binary sheds the code.
  • Ports test call sites of deleted convenience wrappers to the live APIs: NewTool to NewScopedTool, CoreTools to CoreToolsScoped, tools.DeferredLine to tools.DeferredSource, and Truncated() assertions to FinishReason checks.

Kept, with reasons

  • The 13 sandbox windows_*.go functions in the report are false positives on ubuntu. Their callers live in windows build-tagged files, verified by running deadcode with GOOS=windows.
  • cron.Store.Runs is the only reader of runs.jsonl, which production writes via AppendRun. Tests in cron and cli read runs back through it.
  • agenteval.TraceEventKeys and agenteval.MissingTraceEvents are used across packages by the trace contract test.

After this PR the ubuntu deadcode step reports 16 findings: the 13 windows false positives plus the 3 keeps above.

Verification

  • go build ./..., go vet ./..., and gofmt are clean.
  • go test ./... passes.
  • deadcode -test=false ./... rerun under all three GOOS values; the remaining linux findings are exactly the 16 documented above.

Summary by CodeRabbit

  • New Features

    • Added clearer truncation/early-stop notices when responses end due to token limits, content filtering, or other finish reasons.
    • Improved attachment chips by displaying image and document chips together, with a warning when the selected model can’t process images.
    • Enhanced terminal transcript scrolling and overlay rendering.
  • Bug Fixes

    • Strengthened workspace path scoping and safety checks across built-in tools.
    • Refined tool output budgeting/truncation metadata and improved skill discovery across multiple locations.

@kevincodex1
kevincodex1 requested review from Vasanthdev2004, anandh8x, gnanam1990 and jatmn and removed request for anandh8x and gnanam1990 July 17, 2026 04:50
@euxaristia
euxaristia force-pushed the chore/strip-deadcode branch from c600ef2 to 1c9d7f4 Compare July 17, 2026 05:32
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 72757c9c-75dc-4ab9-86ed-7004f0978591

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab9095 and e8f1a45.

📒 Files selected for processing (1)
  • internal/tools/export_test.go
💤 Files with no reviewable changes (1)
  • internal/tools/export_test.go

Walkthrough

The 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.

Changes

API consolidation and test seams

Layer / File(s) Summary
Production API removal and test seams
internal/*, docs/HOW_ZERO_WORKS.md
Exported convenience helpers and redundant internal wrappers are removed or moved into export_test.go seams. Tests are updated for scoped tool constructors, finish-reason notices, and remaining internal entry points.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • Gitlawb/zero#148: Both changes modify agent tool-partitioning and exposed-tool construction.
  • Gitlawb/zero#227: Both changes modify the TUI transcript viewport rendering path.
  • Gitlawb/zero#338: Adds the reasoning catalog later removed by this change.

Suggested reviewers: anandh8x, gnanman1990, vasanthdev2004

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing dead code that is unreachable on all supported platforms.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e666395 and 1c9d7f4.

📒 Files selected for processing (139)
  • internal/acp/agent.go
  • internal/acp/export_test.go
  • internal/acp/types.go
  • internal/agent/additional_permissions_validation_test.go
  • internal/agent/command_prefix.go
  • internal/agent/compaction_preserve.go
  • internal/agent/compaction_test.go
  • internal/agent/deferred_loop_test.go
  • internal/agent/denial_test.go
  • internal/agent/export_test.go
  • internal/agent/guardrails_test.go
  • internal/agent/loop.go
  • internal/agent/loop_test.go
  • internal/agent/partition_cache_stable_test.go
  • internal/agent/request_permissions_test.go
  • internal/agent/types.go
  • internal/agenteval/agent_command.go
  • internal/agenteval/export_test.go
  • internal/config/export_test.go
  • internal/config/types.go
  • internal/config/validate.go
  • internal/config/writer.go
  • internal/contextreport/contextreport_test.go
  • internal/cron/export_test.go
  • internal/cron/schedule.go
  • internal/dictation/dictation.go
  • internal/lsp/export_test.go
  • internal/lsp/registry.go
  • internal/mcp/registry_test.go
  • internal/modelregistry/export_test.go
  • internal/modelregistry/modelsdev.go
  • internal/modelregistry/modes.go
  • internal/notify/export_test.go
  • internal/notify/notify.go
  • internal/providercatalog/catalog.go
  • internal/providercatalog/export_test.go
  • internal/providers/openai/codex.go
  • internal/providers/openai/export_test.go
  • internal/providers/openai/provider_test.go
  • internal/providers/providerio/export_test.go
  • internal/providers/providerio/providerio.go
  • internal/reasoning/capability.go
  • internal/reasoning/catalog.go
  • internal/reasoning/catalog_test.go
  • internal/reasoning/modelsdev_snapshot.json
  • internal/reltime/reltime.go
  • internal/repomap/export_test.go
  • internal/repomap/repomap.go
  • internal/review/export_test.go
  • internal/review/review.go
  • internal/sandbox/export_test.go
  • internal/sandbox/grants.go
  • internal/sandbox/profile.go
  • internal/sandbox/runner.go
  • internal/sandbox/windows_setup.go
  • internal/sessions/checkpoint.go
  • internal/sessions/export_test.go
  • internal/sessions/replay.go
  • internal/skills/export_test.go
  • internal/skills/install.go
  • internal/skills/skills.go
  • internal/specialist/export_test.go
  • internal/specialist/manifest_test.go
  • internal/specialist/output_tool.go
  • internal/specialist/stop_tool.go
  • internal/specialist/streamer.go
  • internal/streamjson/export_test.go
  • internal/streamjson/streamjson.go
  • internal/tools/apply_patch.go
  • internal/tools/argtolerance_test.go
  • internal/tools/ask_user_test.go
  • internal/tools/bash.go
  • internal/tools/bash_auto_allow_test.go
  • internal/tools/bash_tool_test.go
  • internal/tools/builtin_catalog.go
  • internal/tools/deferred.go
  • internal/tools/edit_file.go
  • internal/tools/edit_replacers_test.go
  • internal/tools/exec_command.go
  • internal/tools/export_test.go
  • internal/tools/file_safety_test.go
  • internal/tools/file_tools_test.go
  • internal/tools/format_on_write_test.go
  • internal/tools/glob.go
  • internal/tools/grep.go
  • internal/tools/inline_diagnostics_test.go
  • internal/tools/list_directory.go
  • internal/tools/lsp_navigate.go
  • internal/tools/lsp_navigate_test.go
  • internal/tools/output_ceiling_test.go
  • internal/tools/read_exclusions_test.go
  • internal/tools/read_file.go
  • internal/tools/read_minified_file.go
  • internal/tools/read_minified_file_test.go
  • internal/tools/registry.go
  • internal/tools/registry_test.go
  • internal/tools/sandbox_denial.go
  • internal/tools/search_cancellation_test.go
  • internal/tools/spill_hardening_test.go
  • internal/tools/tool_io_bench_test.go
  • internal/tools/web_fetch.go
  • internal/tools/write_file.go
  • internal/tools/write_tools_test.go
  • internal/trace/emit.go
  • internal/trace/export_test.go
  • internal/trace/trace.go
  • internal/tui/assistant_markdown.go
  • internal/tui/autocomplete.go
  • internal/tui/command_polish_test.go
  • internal/tui/commands.go
  • internal/tui/export_test.go
  • internal/tui/image_attach.go
  • internal/tui/model.go
  • internal/tui/model_test.go
  • internal/tui/mouse.go
  • internal/tui/plan_panel.go
  • internal/tui/pr_status.go
  • internal/tui/render_cache.go
  • internal/tui/selectable_list.go
  • internal/tui/session_test.go
  • internal/tui/spec_mode_test.go
  • internal/tui/specialist_card.go
  • internal/tui/startup.go
  • internal/tui/streaming_decoder.go
  • internal/tui/streaming_fade.go
  • internal/tui/stt_model_picker.go
  • internal/tui/tool_render_registry.go
  • internal/tui/transcript_selection.go
  • internal/tui/transcript_viewport.go
  • internal/update/export_test.go
  • internal/update/update.go
  • internal/verify/export_test.go
  • internal/verify/verify.go
  • internal/workspaceindex/workspaceindex.go
  • internal/zerocommands/backend_snapshots.go
  • internal/zerocommands/contracts.go
  • internal/zerocommands/export_test.go
  • internal/zeroruntime/finish_reason_test.go
  • internal/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

Comment thread internal/config/export_test.go
Vasanthdev2004
Vasanthdev2004 previously approved these changes Jul 17, 2026

@Vasanthdev2004 Vasanthdev2004 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.

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 jatmn 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.

I found issues that need to be addressed before this is ready.

Findings

  • [P2] Rebase this head onto current main before resolving the code review
    The PR head is based on 9043bae, while current main is 18cce35; GitHub reports it as CONFLICTING, 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, and package-lock.json:3
    The base is the already-released v0.4.0, but this cleanup resets all package/release state to 0.3.0 and 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
    parallelSafeToolCall now admits every SideEffectRead tool, but the removed gate required ThreadSafe capability and rejected conflicting resource keys. This is not just conservative metadata: read_file explicitly declares ThreadSafe: false because 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 when dispatchAfterTool returns, but this path appends hook feedback and no longer calls RebudgetAfterHook. 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-specific max_output_tokens budget. 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 removes agent.ToolResult.Truncated, so stream JSON now sets truncated solely from its own 1 MiB serialization cutoff. A read_file/search/command result that was already truncated by the tool but is smaller than that cutoff is emitted as truncated: 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-positive go build check. 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 ValidateFile documentation
    internal/config/export_test.go:21
    The unresolved CodeRabbit comment is valid: ValidateFile returns []Issue with a string Message, after calling .Error() on the wrapped JSON error, so callers cannot use errors.As to recover *json.SyntaxError or *json.UnmarshalTypeError. Remove that claim (and use fmt.Sprintf(...%v...) instead of a discarded %w wrapper) 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 --check reports it), which fails the repository's formatting gate. Remove the extra line so the required smoke/format check can pass.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
internal/agent/loop.go (1)

237-242: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove 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 value

Split 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.go next to foo.go). Since this file bundles tests for multiple tools like read_file.go, list_directory.go, glob.go, grep.go, and write_file.go, consider splitting it into read_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

📥 Commits

Reviewing files that changed from the base of the PR and between 1c9d7f4 and c4fabe7.

📒 Files selected for processing (133)
  • internal/acp/agent.go
  • internal/acp/export_test.go
  • internal/acp/types.go
  • internal/agent/additional_permissions_validation_test.go
  • internal/agent/command_prefix.go
  • internal/agent/compaction_preserve.go
  • internal/agent/compaction_test.go
  • internal/agent/deferred_loop_test.go
  • internal/agent/denial_test.go
  • internal/agent/export_test.go
  • internal/agent/guardrails_test.go
  • internal/agent/loop.go
  • internal/agent/loop_test.go
  • internal/agent/partition_cache_stable_test.go
  • internal/agent/request_permissions_test.go
  • internal/agent/types.go
  • internal/agenteval/agent_command.go
  • internal/agenteval/export_test.go
  • internal/config/export_test.go
  • internal/config/types.go
  • internal/config/validate.go
  • internal/config/writer.go
  • internal/contextreport/contextreport_test.go
  • internal/cron/export_test.go
  • internal/cron/schedule.go
  • internal/dictation/dictation.go
  • internal/lsp/export_test.go
  • internal/lsp/registry.go
  • internal/mcp/registry_test.go
  • internal/modelregistry/export_test.go
  • internal/modelregistry/modelsdev.go
  • internal/modelregistry/modes.go
  • internal/notify/export_test.go
  • internal/notify/notify.go
  • internal/providercatalog/catalog.go
  • internal/providercatalog/export_test.go
  • internal/providers/openai/codex.go
  • internal/providers/openai/export_test.go
  • internal/providers/openai/provider_test.go
  • internal/providers/providerio/export_test.go
  • internal/providers/providerio/providerio.go
  • internal/reasoning/capability.go
  • internal/reasoning/catalog.go
  • internal/reasoning/catalog_test.go
  • internal/reasoning/modelsdev_snapshot.json
  • internal/reltime/reltime.go
  • internal/repomap/export_test.go
  • internal/repomap/repomap.go
  • internal/review/export_test.go
  • internal/review/review.go
  • internal/sandbox/export_test.go
  • internal/sandbox/grants.go
  • internal/sandbox/profile.go
  • internal/sandbox/runner.go
  • internal/sandbox/windows_setup.go
  • internal/sessions/checkpoint.go
  • internal/sessions/export_test.go
  • internal/sessions/replay.go
  • internal/skills/export_test.go
  • internal/skills/install.go
  • internal/skills/skills.go
  • internal/specialist/export_test.go
  • internal/specialist/manifest_test.go
  • internal/specialist/output_tool.go
  • internal/specialist/stop_tool.go
  • internal/specialist/streamer.go
  • internal/streamjson/export_test.go
  • internal/streamjson/streamjson.go
  • internal/tools/apply_patch.go
  • internal/tools/argtolerance_test.go
  • internal/tools/ask_user_test.go
  • internal/tools/bash.go
  • internal/tools/bash_auto_allow_test.go
  • internal/tools/bash_tool_test.go
  • internal/tools/builtin_catalog.go
  • internal/tools/deferred.go
  • internal/tools/edit_file.go
  • internal/tools/edit_replacers_test.go
  • internal/tools/exec_command.go
  • internal/tools/export_test.go
  • internal/tools/file_safety_test.go
  • internal/tools/file_tools_test.go
  • internal/tools/format_on_write_test.go
  • internal/tools/inline_diagnostics_test.go
  • internal/tools/lsp_navigate.go
  • internal/tools/lsp_navigate_test.go
  • internal/tools/read_exclusions_test.go
  • internal/tools/read_minified_file_test.go
  • internal/tools/registry.go
  • internal/tools/registry_test.go
  • internal/tools/sandbox_denial.go
  • internal/tools/search_cancellation_test.go
  • internal/tools/spill_hardening_test.go
  • internal/tools/tool_io_bench_test.go
  • internal/tools/web_fetch.go
  • internal/tools/write_file.go
  • internal/tools/write_tools_test.go
  • internal/trace/emit.go
  • internal/trace/export_test.go
  • internal/trace/trace.go
  • internal/tui/assistant_markdown.go
  • internal/tui/autocomplete.go
  • internal/tui/command_polish_test.go
  • internal/tui/commands.go
  • internal/tui/export_test.go
  • internal/tui/image_attach.go
  • internal/tui/model.go
  • internal/tui/model_test.go
  • internal/tui/mouse.go
  • internal/tui/plan_panel.go
  • internal/tui/pr_status.go
  • internal/tui/render_cache.go
  • internal/tui/selectable_list.go
  • internal/tui/session_test.go
  • internal/tui/spec_mode_test.go
  • internal/tui/specialist_card.go
  • internal/tui/startup.go
  • internal/tui/streaming_decoder.go
  • internal/tui/streaming_fade.go
  • internal/tui/stt_model_picker.go
  • internal/tui/tool_render_registry.go
  • internal/tui/transcript_selection.go
  • internal/tui/transcript_viewport.go
  • internal/update/export_test.go
  • internal/update/update.go
  • internal/verify/export_test.go
  • internal/verify/verify.go
  • internal/workspaceindex/workspaceindex.go
  • internal/zerocommands/backend_snapshots.go
  • internal/zerocommands/contracts.go
  • internal/zerocommands/export_test.go
  • internal/zeroruntime/finish_reason_test.go
  • internal/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 Vasanthdev2004 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.

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 jatmn 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.

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 makes gofmt -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 run gofmt) 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 leaves Sink, NDJSONSink, and TextSink exported and documented as writer-backed sinks, but removes both Emit methods; TextSink also loses its only production emitter when WriteText moves to _test.go. Consequently, an in-module consumer such as var s trace.Sink = trace.NDJSONSink{W: w} no longer compiles, and TextSink cannot emit a trace at all. Retain the methods (and WriteText for 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
    DiscoveryRoots and Duplicates now exist only in export_test.go, yet the retained package documentation and docs/HOW_ZERO_WORKS.md direct 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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 18, 2026
@euxaristia

Copy link
Copy Markdown
Contributor Author

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.

jatmn
jatmn previously approved these changes Jul 19, 2026

@jatmn jatmn 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.

@anandh8x
anandh8x requested a review from Vasanthdev2004 July 19, 2026 06:26
@euxaristia
euxaristia dismissed stale reviews from jatmn and coderabbitai[bot] via 8e110f5 July 19, 2026 08:49
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 19, 2026
@euxaristia

Copy link
Copy Markdown
Contributor Author

Pushed 8e110f5.

Fixed:

  • export_test.go still had fmt.Errorf(...%w...).Error(), which discards the wrapped error immediately. Switched to fmt.Sprintf with %v.
  • loop.go had a 4-line comment block duplicated verbatim above partitionToolsCached. Removed the duplicate.

Not fixing, with reason:

  • The suggestion to split file_tools_test.go (~800 lines) into per-source test files: this structure predates the PR, is unrelated to its actual purpose of removing platform-dead code, and was itself scored lowest severity. Leaving it for a separate refactor if we want it.

Vasanthdev2004
Vasanthdev2004 previously approved these changes Jul 19, 2026

@Vasanthdev2004 Vasanthdev2004 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.

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.

@euxaristia

Copy link
Copy Markdown
Contributor Author

@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.

@kevincodex1

Copy link
Copy Markdown
Contributor

hello @euxaristia please rebase to main and fix conflicts

@euxaristia

Copy link
Copy Markdown
Contributor Author

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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 20, 2026
@euxaristia

Copy link
Copy Markdown
Contributor Author

Addressed the latest CHANGES_REQUESTED findings and rebased onto current main.

Fixed:

  • [P1] gofmt on internal/trace/trace.go: trailing blank line at EOF already removed; gofmt -l is clean on the head.
  • [P2] trace adapters: Sink / NDJSONSink / TextSink were removed together with their contract (no production callers); WriteNDJSON remains the production emitter, and WriteText lives in export_test.go as a test seam. Matches the "remove/update obsolete exported types together" option.
  • [P2] skills docs: package docs and docs/HOW_ZERO_WORKS.md already point at LoadFromRoots / Load instead of DiscoveryRoots / Duplicates. Follow-up on this push: Load and MergedSkills comments no longer name test-only List/Get; they reference Load / ListFromRoots.

Also rebased onto gitlawb/main (was 14 commits behind).

Verified: gofmt -l . clean; go test ./internal/trace/... ./internal/skills/... ./internal/plugins/... -count=1; go vet on the same packages.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 20, 2026

@jatmn jatmn 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.

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 the FinishReason field comment still tells callers that Truncated reports 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 inspect FinishReason directly.

  • [P3] Correct the deferred-MCP helper documentation after moving DeferredLine to test-only code
    internal/tools/deferred.go:40-45
    The production comment says mcpServerNamed is consumed by DeferredLine, but DeferredLine now exists only in export_test.go; production discovery uses DeferredSource. This leaves the retained production source documenting an unavailable helper. Name DeferredSource here, and mark the copied DeferredLine comment as a test seam rather than claiming the agent loop uses it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 win

Use 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

📥 Commits

Reviewing files that changed from the base of the PR and between fe14cf9 and 5ab9095.

📒 Files selected for processing (132)
  • docs/HOW_ZERO_WORKS.md
  • internal/acp/agent.go
  • internal/acp/export_test.go
  • internal/acp/types.go
  • internal/agent/additional_permissions_validation_test.go
  • internal/agent/command_prefix.go
  • internal/agent/compaction_preserve.go
  • internal/agent/compaction_test.go
  • internal/agent/deferred_loop_test.go
  • internal/agent/denial_test.go
  • internal/agent/export_test.go
  • internal/agent/guardrails_test.go
  • internal/agent/loop.go
  • internal/agent/loop_test.go
  • internal/agent/partition_cache_stable_test.go
  • internal/agent/request_permissions_test.go
  • internal/agent/types.go
  • internal/agenteval/agent_command.go
  • internal/agenteval/export_test.go
  • internal/config/export_test.go
  • internal/config/types.go
  • internal/config/validate.go
  • internal/config/writer.go
  • internal/contextreport/contextreport_test.go
  • internal/cron/export_test.go
  • internal/cron/schedule.go
  • internal/dictation/dictation.go
  • internal/lsp/export_test.go
  • internal/lsp/registry.go
  • internal/mcp/registry_test.go
  • internal/modelregistry/export_test.go
  • internal/modelregistry/modelsdev.go
  • internal/modelregistry/modes.go
  • internal/notify/export_test.go
  • internal/notify/notify.go
  • internal/plugins/activate.go
  • internal/providercatalog/catalog.go
  • internal/providercatalog/export_test.go
  • internal/providers/openai/codex.go
  • internal/providers/openai/export_test.go
  • internal/providers/openai/provider_test.go
  • internal/providers/providerio/export_test.go
  • internal/providers/providerio/providerio.go
  • internal/reasoning/capability.go
  • internal/reasoning/catalog.go
  • internal/reasoning/catalog_test.go
  • internal/reasoning/modelsdev_snapshot.json
  • internal/reltime/reltime.go
  • internal/repomap/export_test.go
  • internal/repomap/repomap.go
  • internal/review/export_test.go
  • internal/review/review.go
  • internal/sandbox/export_test.go
  • internal/sandbox/grants.go
  • internal/sandbox/profile.go
  • internal/sandbox/runner.go
  • internal/sandbox/windows_setup.go
  • internal/sessions/checkpoint.go
  • internal/sessions/export_test.go
  • internal/sessions/replay.go
  • internal/skills/export_test.go
  • internal/skills/install.go
  • internal/skills/skills.go
  • internal/specialist/export_test.go
  • internal/specialist/manifest_test.go
  • internal/specialist/output_tool.go
  • internal/specialist/stop_tool.go
  • internal/specialist/streamer.go
  • internal/streamjson/export_test.go
  • internal/streamjson/streamjson.go
  • internal/tools/apply_patch.go
  • internal/tools/argtolerance_test.go
  • internal/tools/ask_user_test.go
  • internal/tools/bash.go
  • internal/tools/bash_auto_allow_test.go
  • internal/tools/bash_tool_test.go
  • internal/tools/builtin_catalog.go
  • internal/tools/deferred.go
  • internal/tools/edit_file.go
  • internal/tools/edit_replacers_test.go
  • internal/tools/export_test.go
  • internal/tools/file_safety_test.go
  • internal/tools/file_tools_test.go
  • internal/tools/format_on_write_test.go
  • internal/tools/inline_diagnostics_test.go
  • internal/tools/lsp_navigate.go
  • internal/tools/lsp_navigate_test.go
  • internal/tools/read_exclusions_test.go
  • internal/tools/read_minified_file_test.go
  • internal/tools/registry.go
  • internal/tools/registry_test.go
  • internal/tools/search_cancellation_test.go
  • internal/tools/spill_hardening_test.go
  • internal/tools/tool_io_bench_test.go
  • internal/tools/web_fetch.go
  • internal/tools/write_file.go
  • internal/tools/write_tools_test.go
  • internal/trace/emit.go
  • internal/trace/export_test.go
  • internal/tui/assistant_markdown.go
  • internal/tui/autocomplete.go
  • internal/tui/command_polish_test.go
  • internal/tui/commands.go
  • internal/tui/export_test.go
  • internal/tui/image_attach.go
  • internal/tui/model.go
  • internal/tui/model_test.go
  • internal/tui/mouse.go
  • internal/tui/plan_panel.go
  • internal/tui/pr_status.go
  • internal/tui/render_cache.go
  • internal/tui/selectable_list.go
  • internal/tui/session_test.go
  • internal/tui/spec_mode_test.go
  • internal/tui/specialist_card.go
  • internal/tui/startup.go
  • internal/tui/streaming_decoder.go
  • internal/tui/streaming_fade.go
  • internal/tui/stt_model_picker.go
  • internal/tui/tool_render_registry.go
  • internal/tui/transcript_selection.go
  • internal/tui/transcript_viewport.go
  • internal/update/export_test.go
  • internal/update/update.go
  • internal/verify/export_test.go
  • internal/verify/verify.go
  • internal/workspaceindex/workspaceindex.go
  • internal/zerocommands/backend_snapshots.go
  • internal/zerocommands/contracts.go
  • internal/zerocommands/export_test.go
  • internal/zeroruntime/finish_reason_test.go
  • internal/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

Comment thread internal/tools/export_test.go Outdated
jatmn

This comment was marked as off-topic.

@jatmn jatmn 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.

I found issues that need to be addressed before this is ready.

Findings

  • [P1] Restore a compilable internal/tools test package
    internal/tools/export_test.go:133-141
    The new test seam tries to add a method to execSessionManager, which is now an alias for execution.ProcessManager; Go forbids methods on that non-local type, and the referenced mu and sessions fields no longer exist. The following helper also calls the removed sandboxDenialKind. As a result, go vet ./... and go 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 in export_test.go: CollectedStream.Truncated, DeferredLine, ValidateFile, and ScanSSEData. 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.

@euxaristia

Copy link
Copy Markdown
Contributor Author

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.

@euxaristia

Copy link
Copy Markdown
Contributor Author

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.

@jatmn jatmn 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.

@kevincodex1

Copy link
Copy Markdown
Contributor

please check bro @Vasanthdev2004

euxaristia and others added 6 commits July 22, 2026 04:07
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.
@euxaristia

Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream main (was 6 commits behind). No conflicts; focused tests for tools/sandbox/skills and go build ./cmd/zero pass locally.

@euxaristia
euxaristia force-pushed the chore/strip-deadcode branch from e8f1a45 to 2c92a55 Compare July 22, 2026 08:08
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.

4 participants