Skip to content

fix(plugins): cap Honcho session name to 100 chars to prevent API errors (#13868)#15380

Open
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/honcho-session-name-length-cap
Open

fix(plugins): cap Honcho session name to 100 chars to prevent API errors (#13868)#15380
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/honcho-session-name-length-cap

Conversation

@Tranquil-Flow

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

Copy link
Copy Markdown
Contributor

What does this PR do?

resolve_session_name() in the Honcho client sanitizes gateway session keys and other identifiers but applies no length truncation. Gateway session keys like agent:main:telegram:group:-1001987654321:12345678:9876543210 with peer prefixes can produce sanitized strings exceeding 100 characters. Honcho's API enforces a 100-character limit on session IDs, causing API errors.

This PR caps the produced name to 100 characters at every return point.

Related Issue

Fixes #13868

Related: #13931

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

  • plugins/memory/honcho/client.py — added _MAX_SESSION_ID_LEN = 100 constant and applied [:_MAX_SESSION_ID_LEN] truncation at all return points in resolve_session_name() — session title, gateway session key, per-session ID, per-repo name, per-directory name, global fallback, and peer-prefixed variants.
  • tests/honcho_plugin/test_session_name_length.py — 6 targeted tests

How to Test

  1. pytest tests/honcho_plugin/test_session_name_length.py -v — 6 tests covering:
    • Source has truncation constant defined
    • Per-repo and per-directory strategies are truncated
    • Long gateway keys are truncated to <= 100 chars
    • Short keys are unchanged
  2. Tested on macOS (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 (Python 3.14)

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/bug Something isn't working P2 Medium — degraded but workaround exists comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers labels Apr 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #15381 (Honcho consolidation PR) which includes this fix among 7 others, and #13931 (original) which uses prefix+sha256 truncation. Consider closing in favor of #15381 for a unified merge.

@Tranquil-Flow Tranquil-Flow force-pushed the fix/honcho-session-name-length-cap branch from 6bc830c to 364f8e0 Compare May 18, 2026 21:16
@Tranquil-Flow Tranquil-Flow force-pushed the fix/honcho-session-name-length-cap branch from 364f8e0 to b47c38c Compare May 25, 2026 11:05
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 P2 Medium — degraded but workaround exists 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.

[Bug]: resolve_session_name sanitizes gateway_session_key without length truncation, overflows Honcho's 100-char session ID limit

2 participants