Skip to content

fix(honcho): sanitize dotted host fallback in workspace_id (#26459) - #26750

Closed
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/26459-honcho-workspace-id-dotted
Closed

fix(honcho): sanitize dotted host fallback in workspace_id (#26459)#26750
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/26459-honcho-workspace-id-dotted

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

What does this PR do?

When `HonchoClientConfig.from_global_config` falls back to `resolved_host` for `workspace` (no explicit `workspace` field in the host block or root), the resolved host is the dotted form `hermes.`. Honcho's API rejects this against the `^[a-zA-Z0-9_-]+$` regex with `string_pattern_mismatch`, and the plugin retries init once per minute, flooding the journal with warnings while memory is silently disabled.

This PR rewrites `.` to `_` on the fallback path only. Explicit user-set `workspace` values are passed through unchanged so configuration mistakes surface as real API errors instead of being silently masked.

Related Issue

Fixes #26459

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature
  • 🔒 Security fix
  • 📝 Documentation update
  • ♻️ Refactor
  • 🧪 Tests only

How was this tested?

Added regression coverage in `tests/honcho_plugin/test_client.py`:

  • `test_workspace_id_sanitizes_dotted_resolved_host_fallback` — reproduces the reporter's exact path (no `workspace` field, resolved_host="hermes.fundraising", asserts workspace_id="hermes_fundraising")
  • `test_workspace_id_preserves_explicit_dotted_user_value` — guards that explicit `workspace: "my.value"` is NOT rewritten (intentional opt-in)
  • `test_workspace_id_unchanged_for_already_safe_host` — baseline regression guard

Full `tests/honcho_plugin/` suite green.

Scope notes (what was deliberately NOT changed)

  • The `host_key` lookup format (used for indexing into `hosts."hermes.X"` blocks in `honcho.json`) is unchanged — only the workspace value sent to the Honcho API is sanitized. Existing installs with dotted outer keys keep working without migration.
  • We did not bundle a legacy-key migration step: the issue reporter described a new-install path, and migrating existing keys would mutate user config silently. If demand surfaces, that can be a follow-up PR with explicit logging.
  • We did not change `resolve_active_host` in `client.py` — the fallback only matters at the workspace_id construction site.

Checklist

  • I have read the contributing guidelines
  • My code follows the existing code style
  • I have added tests that prove my fix is effective
  • All new and existing tests pass locally
  • No README changes needed

…rch#26459)

When ``HonchoClientConfig.from_global_config`` falls back to
``resolved_host`` for ``workspace`` (no explicit ``workspace`` field
in the host block or root), the resolved host is the dotted form
``hermes.<profile>``. Honcho's API rejects this against the
``^[a-zA-Z0-9_-]+$`` regex with ``string_pattern_mismatch``, and the
plugin retries init once per minute, flooding the journal with
warnings while memory is silently disabled.

Rewrite ``.`` to ``_`` on the fallback path only. Explicit user-set
``workspace`` values are passed through unchanged so configuration
mistakes surface as real API errors instead of being silently masked.

This fix is scoped to the new-installs case the reporter described.
Existing installs whose ``honcho.json`` outer keys are the dotted form
(``hosts."hermes.X"``) keep working — the host_key lookup format is
unchanged, only the workspace value sent to the API is sanitized.
@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers P3 Low — cosmetic, nice to have labels May 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #26478 which fixes the same issue (#26459 — dotted host fallback violates Honcho workspace_id regex). Both PRs sanitize dots to underscores on the fallback path.

@Tranquil-Flow

Copy link
Copy Markdown
Contributor Author

Closing as graceful supersession by #26478 (@aqilaziz, opened 2026-05-15, ~1 day earlier). Both PRs sanitize dots to underscores on the fallback workspace ID path.

@aqilaziz's PR has substantially broader coverage (+232/-54 vs ours +55/-2) — additionally migrates legacy dot-form host blocks when the CLI writes profile-scoped config and includes profile-rename handling, docs, and CI stabilizers. Going with theirs. Thanks @aqilaziz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_host_key() returns dot-separated form ("hermes.fundraising") that violates Honcho workspace ID regex

2 participants