Repository navigation
feat: update conversation access rules to allow agents to read projec… - #646
Conversation
…t-shared conversations from other agents
There was a problem hiding this comment.
ℹ️ No critical issues — the authorization logic looks correct. A test-coverage gap and some stale docs, both non-blocking.
Reviewed changes
GetConversationForAgentno longer rejects a cross-agent target up front; the same-agent requirement now applies only to thetarget.ID == currentConversationIDshortcut. Every other conversation is gated byauthorizeConversationsReadForConversationplusauthorizeAgentConversationRead(visibility against the human driving the caller-asserted current conversation).domain/agent/service.gointerface doc comment updated to describe the relaxed rule.- Tests: the "different agent always rejected" case is replaced by a same-project cross-agent allowed case and spoofed/no-current rejected cases.
I traced the branches (GetConversationForAgent L1636-1691, authorizeAgentConversationRead L1742, authorizeConversationAccess L1779, authorizeConversationsReadForConversation L1701): the shortcut still fails closed on a spoofed or uuid.Nil current, global targets still require the same actor, project targets still require the same project plus project_shared/matching session member. Cross-agent reads are now bounded exactly by what the human driving the current conversation could already reach directly, which matches the method's stated model. go test ./internal/service/agent/ ./internal/transport/http/handler/... passes.
ℹ️ Stale descriptions of the authorization rule in apps/mcp
Three comments/tool copy still describe the pre-PR rule that the endpoint authorizes by the target conversation's own agent_id matching the caller. These now contradict the behavior this PR introduces.
Technical details
# Stale cross-agent authorization descriptions
## Affected sites
- apps/mcp/src/api/conversation-client.ts:28-29 — "it authorizes by the server's own verified the calling agent against the conversation's own agent_id" (also an awkward pre-existing phrase).
- apps/mcp/src/__tests__/api/conversation-client.test.ts:121-124 — "this path authorizes by the conversation's own agent_id matching the caller ..., not by project or human membership".
- apps/mcp/src/tools/conversation-tools.ts:33 — tool description: "Works for any conversation you (this agent) participated in", now understated since another agent's project_shared conversation is reachable.
## Required outcome
- Comments/copy should describe the current rule in `agentdom.Service.GetConversationForAgent`: the caller must hold conversations.read, and the target must be visible to the human driving the caller's current conversation. The `PacaConfig.conversationId` comment (apps/mcp/src/types/index.ts:33-37) already reads correctly and is a good reference.
## Open questions for the human
- Whether the tool description should be broadened to mention reading another agent's delegated run, since that is the feature this PR enables.deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
…onversations.read permission
There was a problem hiding this comment.
ℹ️ No critical issues — the previously flagged coverage gap is now closed; one minor copy inaccuracy inline.
Reviewed changes
- Updated the
apps/mcpcomments (conversation-client.tsand its test) to describe the current authorization rule — the caller'sconversations.readgrant plus visibility of the target from the caller's current conversation — instead of the old target-agent_idmatch. - Broadened the
read_conversationtool description to cover reading another agent's delegated run. - Added two cross-agent tests against a wired authorizer: a project
conversations.readgrant succeeds, and no grant is rejected withErrConversationNotFound.
Verified the four TestGetConversationForAgent_DifferentAgent_* cases pass.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
…tanding of context access

Summary
Fixes #634. The MCP
read_conversationtool returnedconversation not found(404) when an agent tried to read another agent's conversation, e.g. a Planner reading the conversation of a Remote Agent it delegated a task to, even when the caller heldconversations.read.Cause
GetConversationForAgentrejected any target conversation whoseagent_iddiffered from the caller's, before theconversations.readand project/audience checks ran. Cross-agent reads could never succeed.Changes
services/api/internal/service/agent/agent_service.go: the same-agent requirement now applies only to the "current conversation" shortcut. Cross-conversation reads (including another agent's) go through the existing checks:conversations.read(global, or in the target's project);services/api/internal/domain/agent/service.go: updated the interface doc comment to match.services/api/internal/service/agent/agent_service_test.go: replaced the "different agent always rejected" test with:Notes
Test plan
go test ./internal/service/agent/ ./internal/transport/http/...go build ./...