Repository navigation
Conversation
A new Bot session bound to the host's primary Agent, because the plugin never named one. The host offers the primary under its canonical name and rejects the legacy `main` alias, so a runtime that still stores the primary under that alias cannot bind it: the session never opens and every turn fails with AGENT_UNAVAILABLE before the model is reached. A Bot team on such a runtime could not talk to its Bots at all. Every turn failed the same way, and the only trace was the generic "The Agent is temporarily unavailable" notice, which reads like a busy host rather than a session that never opened. The turn now names an Agent when the host cannot bind the default one. The Agents the host offers are tried in turn, primary first, and the one that works is used for the sessions that follow, so the probe happens once instead of on every new session. A continued session keeps the Agent it was created with, and a failure that is not a bind failure is never retried with another Agent. When no Agent can be bound, the host's own failure is reported unchanged. The host log now says which Agent was bound, so the fallback is visible next to the turn that used it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What breaks
A Bot team on some MiniMax Code runtimes cannot talk to its Bots at all. Every turn —
message_bot, a group reply, a scheduled task, a background job — fails the same way and nothing reaches the model:The user only sees the generic "The Agent is temporarily unavailable. Try again shortly" notice, which reads like a busy host rather than a session that never opened. On the machine this was found on, 30 Bot turns had been stored and exactly one had succeeded — the greeting Chief sends when it is created. Nothing had ever worked.
Root cause
docs/agent.mdsays a new Node-initiated session runs as "the primary agent", and that an Agent may be named withrun({ agent }), where the name must come fromagents()and "the aliasmainis rejected".The plugin never named one, so every session was created for the primary Agent, and the primary was resolved by that name alone. That works when the runtime stores the primary under its canonical name. It does not when the runtime still stores the primary under the legacy
mainname: the host thenmainas an alias,while the session service resolves the name against the stored registry row. The two never meet, the session is never created, and the turn fails with
AGENT_UNAVAILABLEatcreate-session.The runtime itself reports the split it is in:
legacy_fallbackmeans the canonical row was never seeded and the runtime is serving the legacy one. The rest of the product copes with that (it resolves the primary through the primary-family chain), but the Mini App session path did not.This is visible in the host bundle, not only in the log:
MINIAPP_AGENT_NAME = 'mavis'— the name the Mini App gateway uses for a new session.listAgentOptions()— offersagent.canonicalViewNameand flagsprimary: name === MINIAPP_AGENT_NAME.agentstable (Agent not found: mavis).The fix
The turn now names an Agent when the host cannot bind the default one:
agenton an existing session, and a session keeps the Agent it was created with.AGENT_UNAVAILABLE) triggers the fallback. A busy session is reported asBUSYand a rejected name asINVALID_ARGUMENTS; neither is a bind failure, so neither is retried with a different Agent.minimax_bot.agent_bound), so the fallback is visible next to the turn that used it.On a runtime where the primary binds normally, nothing changes: the default is tried first and succeeds, exactly as before.
Tests
New
tests/agent-binding.test.mjs(5 cases, mock Agent, no model needed):undefined→mavis→general), and the host log names itagentkey is ever sentnpm run checkreportsplugins/minimax-ai/minimax-bot: OK.Tested environment
MiniMax Code 3.1.2 on macOS. The failure was found on macOS 27.2.0 against a runtime that stores its primary under the legacy
mainname; the fix is a host-version-independent code path and the tests use the plugin's own mock Agent, not a real model. The change was not verified end to end against a real host runtime with the legacy-named primary: the installed package is verified by content digest, so a patched build cannot be loaded locally. The behaviour it relies on —agents()returning{ agents: [{ name, displayName, primary }] }andrun({ agent })naming the Agent of a new session — is the contract indocs/agent.md.Note for the host
The deeper fix belongs in the host: the Mini App session path should resolve the primary through the same primary-family chain the rest of the runtime uses, so that a session created for the canonical name binds the primary even when the runtime still stores it under the legacy alias. The change in this pull request is a plugin-side safety net for that case: it keeps a Bot team working without it, and it is a no-op wherever the primary binds normally.
Need help on this PR? Tag
@codesmith-botwith what you need.