Skip to content

feat(agent): auto-migrate Honcho to memory provider plugin#12743

Open
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:feat/honcho-auto-migration
Open

feat(agent): auto-migrate Honcho to memory provider plugin#12743
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:feat/honcho-auto-migration

Conversation

@Tranquil-Flow

@Tranquil-Flow Tranquil-Flow commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

When memory.provider is not set in config but Honcho is actively configured (enabled + credentials in honcho.json), auto-detect and activate it.

  • Extracts detect_honcho_auto_migrate() for testability — returns "honcho" when both enabled=True and at least one credential is present.
  • Persistence is deferred until is_available() confirms the provider works, so broken setups never write stale config entries.
  • One-time "✓ Auto-migrated" message shown to user (suppressed in quiet mode).

Related Issue

N/A — no linked issue; surfaced during memory-provider plugin migration work.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Add detect_honcho_auto_migrate() helper returning "honcho" when Honcho is enabled=True and at least one credential is present.
  • Persist auto-migration to config only after is_available() confirms the provider works.
  • Emit one-time "✓ Auto-migrated" message (suppressed in quiet mode).

How to Test

  1. pytest the eight covering tests:
    • test_detects_active_honcho_with_api_key — enabled + api_key → detected.
    • test_detects_active_honcho_with_base_url_only — enabled + base_url only → detected.
    • test_no_detection_when_honcho_disabled — disabled → not detected.
    • test_no_detection_when_honcho_no_credentials — enabled but no creds → not detected.
    • test_no_detection_when_import_fails — plugin not installed → graceful skip.
    • test_persists_after_available_confirms — persistence guard: only after is_available().
    • test_no_persist_when_provider_not_available — broken setup → no config write.
    • test_no_persist_when_provider_was_explicitly_set — already in config → no duplicate write.

Tests import and call the real detect_honcho_auto_migrate() function with mocked HonchoClientConfig.

Tested on: macOS (Darwin 24.6.0, Python 3.14).

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15 (Darwin 24.6.0)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

N/A — see commit description and PR diff.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent loop, run_agent.py, prompt builder comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers area/config Config system, migrations, profiles labels Apr 23, 2026
@Tranquil-Flow Tranquil-Flow force-pushed the feat/honcho-auto-migration branch from 6ce4179 to db1491f Compare May 19, 2026 13:55
@Tranquil-Flow

Copy link
Copy Markdown
Contributor Author

Re-ported onto current origin/main. AIAgent.__init__ was extracted into agent/agent_init.py::init_agent() upstream, so the original PR's hunk no longer applied.

What changed in the re-port:

  • agent/honcho_auto_migrate.py (new module) — detect_honcho_auto_migrate() lives here as a standalone helper. Same gate as the original PR: enabled=True AND at least one credential (api_key or base_url). Extracted into its own module rather than left at run_agent top-level so unit tests can import it without pulling in the full agent init stack.
  • agent/agent_init.py::init_agent() — wired in at the memory-provider resolution point (right after mem_config.get("provider", "")). An _auto_migrated_to_honcho flag tracks whether this run is using auto-detected Honcho, so persistence is conditional.
  • Persistence still deferred until _mp.is_available() confirms the provider works — broken Honcho setups never write a stale memory.provider: honcho entry. Same guard structure as the original PR.
  • One-time "✓ Auto-migrated" message respects quiet_mode.

New head: db1491f6. 9 tests pass (5 detection + 4 persistence-guard).

@Tranquil-Flow Tranquil-Flow force-pushed the feat/honcho-auto-migration branch from db1491f to 8828b51 Compare May 25, 2026 09:13
@talwayh1

Copy link
Copy Markdown

CI Alert: Test Failure

The Tests workflow failed on the feat/honcho-auto-migration branch (run 26392897600).

Failing test

tests/run_agent/test_memory_provider_init.py::test_blank_memory_provider_does_not_auto_enable_honcho

Root cause

The test expects agent._memory_manager is None when memory.provider is blank ("") — but the auto-migration logic activated honcho anyway:

assert agent._memory_manager is None
E assert <agent.memory_manager.MemoryManager object at 0x7f01d53f20d0> is None

Log confirms: Memory provider 'honcho' activated

Fix needed

The auto-migration code in AIAgent init should skip activation when memory.provider is explicitly blank/empty. The test already exists as a regression guard — update the init logic so this assertion passes.

🤖 Auto-detected by CI Self-Heal watchdog. Branch was deleted but this PR is still open — tagging for your attention.

@Tranquil-Flow Tranquil-Flow force-pushed the feat/honcho-auto-migration branch from 8828b51 to 0b70af0 Compare May 25, 2026 09:41
…ut no provider set

When memory.provider is not set in the user's main config but the
Honcho plugin's own honcho.json shows the integration is enabled with
at least one credential (api_key OR base_url), auto-activate Honcho
as the memory provider for this session.

- agent/honcho_auto_migrate.py — new standalone detection helper
  (detect_honcho_auto_migrate). Read-only; returns "honcho" or "" so
  callers can chain after the explicit-provider check via:
      if not _mem_provider_name:
          _mem_provider_name = detect_honcho_auto_migrate()
- agent/agent_init.py::init_agent() — wired in immediately after
  reading memory.provider from config, with an _auto_migrated_to_honcho
  flag to gate persistence. Persistence to memory.provider only fires
  AFTER the provider passes is_available() — broken Honcho setups
  never write a stale memory.provider: honcho entry to disk.
- One-time "✓ Auto-migrated" message respects quiet_mode.

Re-port of NousResearch#12743 onto current main — AIAgent.__init__ was extracted
into agent/agent_init.py::init_agent() upstream, so the original PR's
hunk no longer applied. The detection helper was moved into its own
module rather than placed at run_agent module-level so unit tests can
import it without pulling in the full agent init stack.
@Tranquil-Flow Tranquil-Flow force-pushed the feat/honcho-auto-migration branch from 0b70af0 to 27759ef Compare May 25, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent loop, run_agent.py, prompt builder comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have tool/memory Memory tool and memory providers type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants