Skip to content

fix(hook): pass LLM config to DI container (GIT-122)#83

Merged
TonyCasey merged 1 commit into
mainfrom
GIT-122
Feb 16, 2026
Merged

fix(hook): pass LLM config to DI container (GIT-122)#83
TonyCasey merged 1 commit into
mainfrom
GIT-122

Conversation

@TonyCasey
Copy link
Copy Markdown
Owner

@TonyCasey TonyCasey commented Feb 16, 2026

Summary

  • hook.ts loaded .git-mem.yaml but never forwarded config.llm to createContainer(), so LLM provider selection always fell back to env-var auto-detection
  • With both ANTHROPIC_API_KEY and OPENAI_API_KEY present, Anthropic was always chosen (first in priority), causing enrichment to time out at 8s
  • One-line fix: pass llm: config.llm to createContainer() so the llm: YAML section is respected

Test plan

  • Lint passes
  • Type-check passes
  • 649/650 tests pass (1 pre-existing failure unrelated to this change)
  • Manual: add llm: { provider: openai } to .git-mem.yaml, make a commit, verify log shows source: "llm-enrichment" instead of timeout

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated hook event handling to include language model configuration in container initialization.

The hook command loaded .git-mem.yaml but never forwarded the llm
config to createContainer(), so provider selection always fell back
to env-var auto-detection. With both ANTHROPIC_API_KEY and
OPENAI_API_KEY present, Anthropic was always chosen, causing
enrichment to time out at 8s on slower responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AI-Agent: Claude-Code/2.1.42
AI-Model: claude-opus-4-6
AI-Gotcha: The hook command must explicitly pass LLM configuration from .git-mem.yaml to the DI container, otherwise provider selection falls back to environment variable auto-detection.
AI-Confidence: verified
AI-Tags: hook, dependency-injection, llm-config, git-mem-yaml, anthropic, openai, environment-variables, provider-selection, timeout, enrichment, performance, create-container
AI-Lifecycle: project
AI-Memory-Id: 1026229e
AI-Source: llm-enrichment
Copilot AI review requested due to automatic review settings February 16, 2026 09:21
@chatgpt-codex-connector
Copy link
Copy Markdown

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Adds the llm property from configuration to the scope-backed container creation call in hook event handling. No changes to control flow, event handling logic, input normalization, event building, or output/logging behavior.

Changes

Cohort / File(s) Summary
Hook Container Configuration
src/commands/hook.ts
Added llm: config.llm property to the container creation scope for hook events.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • #57: Modifies dependency injection container wiring to include LLM client for hook handler scope.
  • #58: Updates src/commands/hook.ts with environment loading and repository root handling logic.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: passing LLM config to the DI container in the hook command, matching the primary objective of the PR.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch GIT-122

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes hook execution to respect the .git-mem.yaml llm: configuration by forwarding config.llm into the DI container, ensuring LLM provider/model selection doesn’t incorrectly fall back to env-var auto-detection during hooks.

Changes:

  • Pass llm: config.llm into createContainer() from hook.ts so hooks use the configured LLM provider/model.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TonyCasey TonyCasey merged commit 09ff7bf into main Feb 16, 2026
9 checks passed
@TonyCasey TonyCasey deleted the GIT-122 branch February 16, 2026 09:46
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.

2 participants