Skip to content

refactor: agent config helper, integration helpers split, and tool cleanup - #364

Merged
grouville merged 9 commits into
dagger:mainfrom
awdemos:upstream-pr/refactors
Aug 12, 2026
Merged

refactor: agent config helper, integration helpers split, and tool cleanup#364
grouville merged 9 commits into
dagger:mainfrom
awdemos:upstream-pr/refactors

Conversation

@awdemos

@awdemos awdemos commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

A bundle of internal refactors that reduce duplication and tighten the public surface area:

  1. mcpserver: collapse wrapTool and wrapToolWithClient into one wrapper.
  2. mcpserver: remove single-field single-tenant setters that were only used by tests.
  3. environment: share service startup and tunneling logic between RunBackground and startService.
  4. integration tests: split helpers.go into setup.go, actions.go, and direct.go, then remove the stale monolith.
  5. agent config: centralize config-file error wrapping in writeMcpConfig and use it across all agent configs (Claude, Codex, Cursor, Goose, Q).
  6. environment: introduce FileEditRequest to reduce FileEdit parameter count.
  7. environment: split FileRead into FileRead and FileReadRange.

Order / dependencies

This PR must be merged after the three feature PRs in this series:

  1. mcpserver: add MCP roots support for better repo-open error messages
  2. repository: inherit project-level git config and never run user hooks
  3. mcpserver: add environment_log and environment_diff tools

The refactor branch is based on upstream/main plus those three changes, so once they land this PR will show only the refactor commits.

@awdemos

awdemos commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

This is a useful refactor, but it needs conflict resolution before it can land.

What it does well:

  • Extracts a shared writeMcpConfig helper across agent configurations.
  • Introduces FileEditRequest to reduce FileEdit's parameter count.
  • Splits FileRead into FileRead and FileReadRange.
  • Splits the integration test helpers into smaller, focused files.
  • Tests pass locally: go test -short ./... passes.

Blocker:

  • GitHub reports the PR as conflicting with main. The merge-tree output shows conflicts in cmd/container-use/agent/configure.go, configure_claude.go, configure_codex.go, etc. These overlap with other recently opened/merged agent config changes.

Recommendation: rebase onto upstream/main, resolve the agent-config conflicts, and push the updated branch.

@awdemos
awdemos force-pushed the upstream-pr/refactors branch from a07f15b to 8deacef Compare August 12, 2026 12:04
@awdemos

awdemos commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

I rebased this PR onto upstream/main and resolved the agent-config conflicts. The branch is now clean and mergeable — ok github.com/dagger/container-use/cmd/container-use (cached)
ok github.com/dagger/container-use/cmd/container-use/agent (cached)
ok github.com/dagger/container-use/environment (cached)
ok github.com/dagger/container-use/environment/integration (cached)
ok github.com/dagger/container-use/mcpserver (cached)
ok github.com/dagger/container-use/repository (cached)
? github.com/dagger/container-use/rules [no test files] passes. No further action needed from the author unless they want to review the rebased history.

@grouville
grouville self-requested a review August 12, 2026 16:27
@grouville
grouville merged commit 98dcadc into dagger:main Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants