Skip to content

chore: merge agent crate into config#2554

Open
RefuseOdd wants to merge 4 commits into
Hmbown:mainfrom
RefuseOdd:fix/2251-merge-agent-crate-into-config
Open

chore: merge agent crate into config#2554
RefuseOdd wants to merge 4 commits into
Hmbown:mainfrom
RefuseOdd:fix/2251-merge-agent-crate-into-config

Conversation

@RefuseOdd
Copy link
Copy Markdown

@RefuseOdd RefuseOdd commented Jun 2, 2026

Summary

Merges crates/agent (539 lines) into crates/config as a new model_registry module. The agent crate only provides ModelRegistry, ModelInfo, and ModelResolution — all conceptually configuration concerns. All three consumers (core, cli, app-server) already depend on config.

Changes

  • Move ModelRegistry, ModelInfo, ModelResolution into crates/config/src/model_registry.rs
  • Re-export public types from codewhale_config
  • Update core, cli, app-server to import from codewhale_config instead of codewhale_agent
  • Remove crates/agent/ directory and drop from [workspace.members]

Verification

cargo check --workspace passes.

Closes #2251

Greptile Summary

This PR merges crates/agent into crates/config by moving ModelRegistry, ModelInfo, and ModelResolution into a new crates/config/src/model_registry.rs module and re-exporting the public types from codewhale_config. All three consumer crates (core, cli, app-server) are updated to import from codewhale_config instead of codewhale_agent, and the agent crate is removed from the workspace.

  • The moved file is a near-identical rename — only the codewhale_config::ProviderKind import becomes crate::ProviderKind; all logic, tests, and doc comments are preserved.
  • Build tooling (scripts/release/crates.sh), the provider-drift checker (scripts/check-provider-registry.py), release runbook, and architecture docs are all consistently updated to reflect the new module location.

Confidence Score: 5/5

Safe to merge — this is a pure mechanical relocation with no behavioral changes.

The move is a near-verbatim file rename: the only code change is one import path. All consumer call sites are updated consistently, the serde dependency already exists in crates/config, all tests travel with the module unchanged, and every piece of supporting tooling is updated to point at the new path.

No files require special attention.

Important Files Changed

Filename Overview
crates/config/src/model_registry.rs New module moved verbatim from crates/agent/src/lib.rs; only the ProviderKind import path was updated to use crate::. All logic, tests, and doc comments are intact.
crates/config/src/lib.rs Adds pub mod model_registry declaration and re-exports of the three public types at the end of the file (before the test section).
scripts/check-provider-registry.py Variable renamed from agent_rs/AGENT_RS to model_registry_rs/MODEL_REGISTRY_RS and path updated to the new location; logic is unchanged and still correct.
scripts/release/crates.sh Removes codewhale-agent from the publish list; remaining crates and their order are unchanged.
Cargo.toml Removes crates/agent from [workspace.members]; workspace metadata is otherwise unchanged.
crates/core/src/lib.rs Import of ModelRegistry updated from codewhale_agent to codewhale_config; no other changes.
crates/cli/src/lib.rs Import of ModelRegistry updated from codewhale_agent to codewhale_config; no other changes.
crates/app-server/src/lib.rs Import of ModelRegistry updated from codewhale_agent to codewhale_config; no other changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[crates/agent/src/lib.rs\nModelRegistry, ModelInfo, ModelResolution] -->|moved to| B[crates/config/src/model_registry.rs]
    B -->|pub mod + pub use re-export| C[codewhale_config crate public API]
    C --> D[crates/core]
    C --> E[crates/cli]
    C --> F[crates/app-server]
    G[crates/agent removed from workspace] -.->|was dependency of| D
    G -.->|was dependency of| E
    G -.->|was dependency of| F
Loading

Reviews (3): Last reviewed commit: "Fix duplicate entry in ARCHITECTURE.md" | Re-trigger Greptile

Moves ModelInfo, ModelRegistry, and ModelResolution from crates/agent into
codewhale_config as a model_registry module. All three consumers (core, cli,
app-server) already depended on codewhale-config, so no new dependency edges
are introduced.

- Move agent/src/lib.rs into config/src/model_registry.rs
- Re-export types from config/lib.rs
- Update use statements in core, cli, app-server
- Remove codewhale-agent dependency from consumer Cargo.toml files
- Remove crates/agent/ directory and workspace member entry

Closes Hmbown#2251
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment thread crates/config/src/lib.rs
Comment on lines +2260 to +2261
pub mod model_registry;
pub use model_registry::{ModelInfo, ModelRegistry, ModelResolution};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Module declaration at end of filepub mod model_registry and its pub use re-exports are placed at line 2260, after all impl blocks and just before the #[cfg(test)] section. In idiomatic Rust, mod declarations conventionally live near the top of the crate root (after attributes and top-level use imports), so future readers scanning the file can immediately see what modules the crate provides. Consider moving these two lines to the top of lib.rs.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code Fix in Cursor

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented Jun 2, 2026

Thanks @RefuseOdd. I reviewed this while triaging #2504 for v0.8.50, and the consolidation direction looks reasonable.

I’m leaving it out of the v0.8.50 harvest branch for now only because deleting/moving a published workspace crate needs the release surfaces to move with it. The follow-up checklist I’d want before this lands:

  • Update scripts/release/crates.sh / published-crate order if codewhale-agent is removed.
  • Update docs/RELEASE_RUNBOOK.md, docs/ARCHITECTURE.md, and docs/PROVIDERS.md so they no longer describe codewhale-agent / crates/agent as current.
  • Point scripts/check-provider-registry.py at the new static registry module path.
  • Run full CI, since this changes workspace membership and package boundaries.

Keeping it out of #2504 avoids mixing a crate-publishing boundary change into this release branch before those docs/scripts are aligned, but this is useful cleanup work and worth continuing.

RefuseOdd and others added 3 commits June 2, 2026 18:00
Updated description of the config crate to include model/provider registry.
Removed duplicate entry for 'crates/config' in architecture documentation.
@RefuseOdd
Copy link
Copy Markdown
Author

Thanks @RefuseOdd. I reviewed this while triaging #2504 for v0.8.50, and the consolidation direction looks reasonable.

I’m leaving it out of the v0.8.50 harvest branch for now only because deleting/moving a published workspace crate needs the release surfaces to move with it. The follow-up checklist I’d want before this lands:

  • Update scripts/release/crates.sh / published-crate order if codewhale-agent is removed.
  • Update docs/RELEASE_RUNBOOK.md, docs/ARCHITECTURE.md, and docs/PROVIDERS.md so they no longer describe codewhale-agent / crates/agent as current.
  • Point scripts/check-provider-registry.py at the new static registry module path.
  • Run full CI, since this changes workspace membership and package boundaries.

Keeping it out of #2504 avoids mixing a crate-publishing boundary change into this release branch before those docs/scripts are aligned, but this is useful cleanup work and worth continuing.

Thanks, that makes sense. I pushed 009cd0c to align the release surfaces after removing codewhale-agent:

  • removed codewhale-agent from scripts/release/crates.sh
  • removed it from the release crate lists in docs/RELEASE_RUNBOOK.md
  • updated docs/PROVIDERS.md to point at crates/config/src/model_registry.rs
  • updated scripts/check-provider-registry.py to read the new registry location
  • folded the ModelRegistry note into the existing crates/config entry in docs/ARCHITECTURE.md

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.

crate consolidation: merge agent crate into config

2 participants