feat(team): multi-bot Discord delivery, memory team scoping, vision fallbackFeat/team discord fixes#592
Open
kokorolx wants to merge 8 commits intonextlevelbuilder:mainfrom
Open
Conversation
kokorolx
commented
Mar 30, 2026
- fix(agent): Anthropic HTTP 400 — keep tool defs on final iteration
- feat(team): Direct delivery — members post via own bot
- feat(team): chat_team_map routing, memory team scoping, logging
- fix(tools): read_image fallback khi path outside workspace
28d70d0 to
ad441fc
Compare
…TP 400 On the last iteration the loop set toolDefs = nil to force a text-only response, but the conversation history still contained tool_use/tool_result messages. Anthropic (and LiteLLM proxy) reject requests that include tool messages without a top-level tools parameter. Instead of stripping tools, keep them and set tool_choice="none" so the API enforces text-only at the protocol level. Added ToolChoice field to ChatRequest and wired it through both OpenAI-compat and Anthropic providers. Also removed temperature from thinking-enabled requests to avoid proxy 400 errors (Anthropic requires temperature=1 default with extended thinking).
…rectly When a team member (e.g. CTO) completes a task, their response is now posted directly to the origin Discord channel via their own bot identity, instead of being relayed through the lead agent (PM). Changes: - message tool: relax self-send guard for team task runs so members can use message() to post updates during execution - consumer: post member completion result directly via member agent channel (resolved via ChannelForAgent), falling back to origin channel - announce queue: when all entries are direct-delivered, instruct leader to respond NO_REPLY unless it has new information to add - manager: add ChannelForAgent() to resolve agent key → channel name This creates a natural conversation flow where each agent speaks for themselves, like a normal team chat.
…ry logging, agent workspace preservation - Add chat_team_map support for Discord channels to route inbound messages to correct team based on channel snowflake ID - Scope memory search (FTS + vector) by team_id to prevent cross-project contamination when same PM agent serves multiple teams - Populate team_id on memory_documents and memory_chunks during write - Relax NO_REPLY instruction to allow PM to create follow-up tasks (e.g. CTO review gate) after direct delivery of member results - Add direct delivery logging with channel, chat_id, fallback info - Fix Discord connect race: register message handler after bot identity fetch - Preserve agent base workspace in team context for file tool access - Add TryMarkListed atomic helper for team task state transitions
…nied When team workspace is active, uploaded images are in per-user .uploads/ dir which falls outside the team workspace boundary. Instead of failing with access denied, fall back to context images already loaded in memory by enrichInputMedia.
ad441fc to
efb8b5f
Compare
…ults on budget exceed - Parallel tool batch: collect deferredWarnings, append all tool_result messages first, then warnings — prevents user-role messages from interleaving with tool_result blocks (Anthropic requires tool_results immediately after tool_use) - When toolResultBreak fires mid-batch, finish appending remaining tool_result messages before breaking to keep assistant/tool_result pairs intact - On tool budget exceeded: synthesize tool_result for each pending tool_use before injecting the budget-exceeded user message - gateway_announce_queue: strengthen follow-up task prompt (MUST check, not SHOULD) - gateway_consumer_handlers/normal: send LLM error alerts on agent run failure - shell_deny_groups: fix 'host' deny pattern — match only at command position to avoid blocking 'hostname', 'hostnamectl' etc - claude_cli_deny_patterns: same host pattern fix
Tasks assigned an owner but never dispatched (e.g. PM session timeout mid-turn) accumulate as pending with owner_agent_id set. Without this fix they sit until 2h stale threshold — or forever if PM doesn't retry. - Add TaskDispatcher interface (DispatchTaskToAgent + CachedGetAgentByID + Store) - Add SetDispatcher() on TaskTicker; wire TeamToolManager at startup via type assertion - Add Step 6 in recoverAll: ListOrphanedPendingTasks (pending + owner + updated_at > 10m) → dispatch directly to assigned agent, bypassing PM - Add ListOrphanedPendingTasks to TaskRecoveryStore interface + PG + SQLite impls
- Guard GetTeam nil result to prevent nil pointer dereference - Use WithCrossTenant context so GetTeam bypasses tenant filter - Remove tenant_id WHERE clause from ListOrphanedPendingTasks (cross-tenant query)
Prevents 'can't find browser binary' on systems where Chrome/Chromium is installed in non-standard paths (e.g. /snap/bin/chromium)
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.