Skip to content

Comments

feat: channel-to-workspace routing control plane (epic #30)#39

Open
drpedapati wants to merge 6 commits intodevelopmentfrom
feature/epic30-routing-control-plane
Open

feat: channel-to-workspace routing control plane (epic #30)#39
drpedapati wants to merge 6 commits intodevelopmentfrom
feature/epic30-routing-control-plane

Conversation

@drpedapati
Copy link
Owner

Summary

Implements collaborative routing so each chat room/thread can map to a dedicated workspace with per-mapping sender ACLs, plus operations CLI and runtime reload support.

Included

  • Routing config schema + strict validation (routing.enabled, unmapped_behavior, mappings[])
  • Gateway routing resolver with exact (channel, chat_id) matching
  • Per-workspace AgentLoop pool (lazy create + reuse)
  • Session namespacing: <channel>:<chat_id>@<workspace_hash>
  • Routing control-plane CLI (routing status/list/add/remove/set-users/validate/explain/enable/disable/import/export/reload)
  • Runtime hot-reload trigger (sciclaw routing reload) via resolver replacement in running gateway
  • Structured routing events (route_match, route_unmapped, route_deny, route_invalid, reload success/failure logs)
  • Doctor diagnostics for routing health
  • README/docs runbook section for collaborative routing

Commits

  • f7f9eff config schema + validation
  • fe119d9 resolver + dispatcher + loop pool
  • 8451582 routing CLI
  • 14d77c6 doctor diagnostics
  • bdba7ca runtime hot reload trigger
  • 86563ec docs/runbook

Verification

  • go test ./pkg/config ./pkg/routing ./pkg/agent ./cmd/picoclaw

Closes #30

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86563ecc38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if err != nil {
return nil, err
}
return agent.NewAgentLoop(cloned, msgBus, provider), nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Register cron tooling on routed workspace loops

This pool factory creates routed handlers with agent.NewAgentLoop(...) only, but the cron tool is wired separately on the singleton gateway loop via setupCronTool. In routing mode, user traffic is handled by these pooled loops, so mapped chats lose the cron tool and reminder/scheduling requests that work in non-routing mode will fail for routed workspaces.

Useful? React with 👍 / 👎.

Comment on lines +1214 to +1215
if cfg.Routing.Enabled {
resolver, err := routing.NewResolver(cfg)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Initialize routing dispatcher even when startup flag is off

Routing dispatch/reload is only started when cfg.Routing.Enabled is already true at gateway boot. If operators start from the default disabled state and then run sciclaw routing enable plus sciclaw routing reload, there is no running watcher/dispatcher to apply it, so messages keep flowing through the non-routing path and ACL/mapping enforcement does not take effect until a full restart.

Useful? React with 👍 / 👎.

Comment on lines +559 to +560
if strings.TrimSpace(out.UnmappedBehavior) == "" {
out.UnmappedBehavior = config.RoutingUnmappedBehaviorBlock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve unmapped behavior on partial routing imports

mergeRouting is written to keep the current unmapped_behavior when the import omits it, but decodeRoutingPayload force-fills empty values with block first. That means a mapping-only import silently changes an existing default policy back to block, altering routing behavior even though the input did not specify a policy change.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant