Skip to content

feat(channels): SidecarChannelConfig.agent + available_agents (#5671 PR-A)#6105

Merged
houko merged 4 commits into
mainfrom
feat/channel-routing-config
Jun 14, 2026
Merged

feat(channels): SidecarChannelConfig.agent + available_agents (#5671 PR-A)#6105
houko merged 4 commits into
mainfrom
feat/channel-routing-config

Conversation

@houko

@houko houko commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

First atomic slice (PR-A: config schema) of the Model A channel-routing redesign from RFC #5671. Additive and non-breaking — it lays the schema foundation without changing any dispatch behaviour.

This is PR 1 of ~9. It deliberately does not touch resolve_or_fallback, the dispatch path, or add the conversation_bindings table — those land in later PRs.

Change

crates/librefang-types/src/config/types.rs, SidecarChannelConfig:

  • Rename default_agentagent with #[serde(default, alias = "default_agent")] so existing configs that use default_agent keep deserializing unchanged.
  • Add available_agents: Vec<String> (#[serde(default)]) — the whitelist that the forthcoming /agent command will consult. Reserved/not yet read by any code.
  • Updated the struct doc + [[sidecar_channels]] example block, and the 5 SidecarChannelConfig field read-sites (channel_bridge.rs, channel_sender.rs, messaging.rs, sidecar.rs tests). InboxConfig.default_agent, AgentRouter.default_agent, and the OpenClaw importer's default_agent are different structs and are untouched.

agent stays Option<String> for now — mandatory enforcement + boot validation is a later PR.

Deferred

A WARN on the deprecated default_agent key isn't cleanly doable without custom Deserialize (the serde alias gives no signal which key was used); it'll go in the boot-validation PR via the config validate() path.

Tests

  • sidecar_agent_field_accepts_legacy_and_new_keys: default_agent = "x" loads into agent = Some("x") via the alias; agent = "x" loads directly; absent → None; available_agents defaults to empty and round-trips.

Test plan

  • cargo test -p librefang-types sidecar_agent_field_accepts_legacy_and_new_keys
  • cargo build -p librefang-kernel -p librefang-channels -p librefang-api
  • cargo clippy -p librefang-types --lib -- -D warnings

Refs #5671 (PR-A of the Model A redesign; does not close the issue).

…PR-A)

First, additive, non-breaking slice of the Model A channel-routing redesign (#5671). Renames SidecarChannelConfig.default_agent -> agent with #[serde(alias = "default_agent")] so existing configs keep deserializing, and adds available_agents: Vec<String> (the future /agent whitelist, not yet consulted). No mandatory enforcement, no dispatch/fallback changes, no conversation_bindings table -- those are later PRs. Updated the 5 SidecarChannelConfig field read-sites and a serde roundtrip test.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
librefang-deploy 3153ba6 Jun 14 2026, 07:05 PM

@github-actions github-actions Bot added size/M 50-249 lines changed area/docs Documentation and guides area/channels Messaging channel adapters area/kernel Core kernel (scheduling, RBAC, workflows) ready-for-review PR is ready for maintainer review labels Jun 14, 2026
CHANGELOG bullet and three `///` doc-comment blocks added in the PR-A
schema commit used column-wrapped mid-sentence line breaks.
Project rule (CLAUDE.md): one sentence per line in CHANGELOG bullets
and doc-comments; editors soft-wrap.

No logic change.
@houko
houko merged commit 535bb06 into main Jun 14, 2026
32 of 33 checks passed
@houko
houko deleted the feat/channel-routing-config branch June 14, 2026 19:32
DaBlitzStein added a commit to DaBlitzStein/librefang that referenced this pull request Jun 16, 2026
…d wake-idle response to channel

The wake-idle turn spawned by the async task tracker correctly ran the
delegating agent's loop and produced a response, but discarded it
because the spawn is not in the channel bridge's call path.

- Thread chat_id from the caller's SenderContext through
  send_to_agent_async_tracked, register_async_task, and PendingTask.
- In spawn_wake_idle_turn, after the agent loop completes, forward the
  response to the home channel via send_channel_message when a chat_id
  is available.
- Fix resolve_agent_home_channel to match the agent field on
  SidecarChannelConfig (renamed from default_agent in librefang#6105).
- Pass sender_context (home channel) to send_message_full in the
  wake-idle path so the agent loop sees channel context.
- When a delegation result exceeds 500 bytes, spill it to the artifact
  store and include the real handle in the TaskStatus payload so
  read_artifact can retrieve the full content (stops the agent from
  hallucinating sha256 hashes). Both format_task_completion_text
  functions (kernel + runtime) surface the handle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/channels Messaging channel adapters area/docs Documentation and guides area/kernel Core kernel (scheduling, RBAC, workflows) ready-for-review PR is ready for maintainer review size/M 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants