Skip to content

refactor: finish cooldown agent registry inversion#403

Merged
cmbays merged 1 commit intomainfrom
codex-fix-cooldown-agent-registry
Mar 23, 2026
Merged

refactor: finish cooldown agent registry inversion#403
cmbays merged 1 commit intomainfrom
codex-fix-cooldown-agent-registry

Conversation

@cmbays
Copy link
Owner

@cmbays cmbays commented Mar 23, 2026

Summary

  • move agent registry construction up into CooldownSession
  • make CooldownBeltComputer depend on a narrow local CooldownAgentRegistry seam instead of infra
  • lock the runtime wiring with session and belt-computer tests

Testing

  • npx vitest run --config vitest.unit.config.ts src/features/cycle-management/cooldown-belt-computer.test.ts src/features/cycle-management/cooldown-session.unit.test.ts
  • npx vitest run --config vitest.acceptance.config.ts src/features/cycle-management/cooldown-belt-computer.feature
  • npm run typecheck
  • npm run test:arch

Summary by CodeRabbit

  • Refactor

    • Restructured agent registry dependency injection from filesystem-based to interface-driven pattern in cooldown management features.
  • Tests

    • Updated test infrastructure to use in-memory registry stubs instead of filesystem operations across cycle-management test suite.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copy link
Owner Author

@cmbays cmbays left a comment

Choose a reason for hiding this comment

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

Reviewed locally and on the diff. LGTM — ready to merge.

Clean inversion:

  • KataAgentRegistry import removed from cooldown-belt-computer.ts — zero infra coupling in the features-layer service
  • CooldownAgentRegistry interface defined locally — narrow, features-owned contract
  • agentDir removed from CooldownBeltDeps — belt computer no longer knows about directories
  • resolveAgentRegistry() follows the established resolve* pattern in the orchestrator
  • Runtime wiring locked by test assertion (agentRegistry.list called)

Completes the inversion that #402 left as a test-only seam.

@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dd4f47dd-98b1-46de-89d6-bedb53d5f671

📥 Commits

Reviewing files that changed from the base of the PR and between 8b81c57 and 812be0c.

📒 Files selected for processing (5)
  • src/features/cycle-management/cooldown-belt-computer.steps.ts
  • src/features/cycle-management/cooldown-belt-computer.test.ts
  • src/features/cycle-management/cooldown-belt-computer.ts
  • src/features/cycle-management/cooldown-session.ts
  • src/features/cycle-management/cooldown-session.unit.test.ts

📝 Walkthrough

Walkthrough

Replace filesystem-based agent directory setup with dependency-injected CooldownAgentRegistry interface across cycle-management tests and source. Introduce new registry interface, remove agentDir from dependencies, and add registry resolution helper in CooldownSession.

Changes

Cohort / File(s) Summary
Core Registry Interface & Deps Wiring
src/features/cycle-management/cooldown-belt-computer.ts, src/features/cycle-management/cooldown-session.ts
Introduced CooldownAgentRegistry interface with list() method returning { id, name } entries. Updated CooldownBeltDeps to replace agentDir and Pick<KataAgentRegistry, 'list'> with CooldownAgentRegistry. Added resolveAgentRegistry() helper in CooldownSession to provide injected registry or construct one from agentDir when needed.
Test Step Definitions
src/features/cycle-management/cooldown-belt-computer.steps.ts
Replaced filesystem operations (directory/file creation) with in-memory agentRegistry stub. Updated Given steps to mock registry behavior via agentRegistry.list instead of writing JSON files. Removed node:fs usage for agent record persistence.
Unit Tests
src/features/cycle-management/cooldown-belt-computer.test.ts, src/features/cycle-management/cooldown-session.unit.test.ts
Refactored tests to inject agentRegistry stub instead of relying on filesystem. Removed KataAgentRegistry instantiation. Updated assertions to verify agentRegistry.list() interactions and added coverage for registry-driven control flow and failure cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping from files to memory we go,
Registry stubs steal the show,
No more disk writes, just injected cheer,
Dependencies cleaner, the path is clear! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex-fix-cooldown-agent-registry

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 and usage tips.

@cmbays cmbays merged commit bf2738b into main Mar 23, 2026
2 of 3 checks passed
@cmbays cmbays deleted the codex-fix-cooldown-agent-registry branch March 23, 2026 01:24
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.

1 participant