Repository navigation
fix: accept agent_id from params in registry channel join for register-on-join flow - #70
Merged
Merged
Conversation
…r-on-join flow Phoenix channels have isolated socket assigns per channel process. When using the register-on-join flow (connect without agent_id, then join agent:register), the agent_id assigned during registration is not visible to subsequent registry channel joins. This caused 'agent_id_required' errors when plugins tried to join registry channels after registering. Accept agent_id from join params as a fallback when socket assigns are empty. The existing authorize_registry_join/2 call ensures the agent exists and belongs to the requested registry.
Plugin stderr bleeds into the OpenCode TUI input area, creating visual noise. Remove informational lifecycle logs (connected, disconnected, recovered) while keeping error/failure logs that indicate actual problems.
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.
Summary
agent_id_requirederror when plugins join registry channels after using the register-on-join WebSocket flowagent_idassigned duringagent:registerjoin is not visible to subsequentregistry:{token}channel joins on the same socket connectionagent_idfrom join params as a fallback whensocket.assigns.agent_idis nil;authorize_registry_join/2still validates the agent exists and belongs to the registryChanges
Server (
lib/viche_web/channels/agent_channel.ex)Registry join handler now falls back to
params["agent_id"]when socket assigns are empty. Security is preserved —authorize_registry_join/2validates agent membership.Client (
channel/opencode-plugin-viche/service.ts)Passes
{ agent_id: agentId }when joining registry channels after registration.Tests (
test/viche_web/channels/agent_channel_test.exs)agent_idin params succeedsagent_id_requiredwhen neither assigns nor params containagent_id