Repository navigation
feat(organization-search): run organization search tools in workflows as the run's person - #10534
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[High impact] The PR appears safe to merge, with no new blocking issue found. SummaryAdds Organization Search tools that run as the person who started the workflow.
|
There was a problem hiding this comment.
All reported issues were addressed across 39 files
This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 39 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 39 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
… as the run's person - organization_delegated executor principal, minted from a bound executor delegation; the organization comes from the workflow's workspace, a run without a person fails with subject_user_required - executor admitted on organization knowledge search, document read, and people list/get - Organization Search block (type organization): search, read_document, search_people, sharing the Search MCP tool implementations - widen the Search MCP activity tool_name check for search_experts, list_my_activity, list_my_chat_history
…le results, pass native queries - workflow Organization Search tools require Search for the organization, as MCP and the Assistant do - search_people imports query provenance and projects its result like search and read_document - organization_search accepts nativeQueries so a workflow can follow account cursors - bound documentIds to 1-10 in the tool schema; declare the actorless refusal; rename the raw call field
…d multi-document reads to workflows
…ter staging's 0477 and 0478
0b9ec3d to
558995c
Compare
…ad continuations in the block
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…ol family, format migration meta
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 39 files
Confidence score: 3/5
organization.tsleavessearchDocumentIdsin the mapped payload, but the Organization Search handler’s strict schema does not allow it. Remove the extra field so validation can accept the payload.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/blocks/blocks/organization.ts">
<violation number="1" location="apps/sim/blocks/blocks/organization.ts:210">
P2: `searchDocumentIds` remains in the mapped payload alongside its converted `documentIds` value. Because the Organization Search handler validates against a strict schema that does not declare `searchDocumentIds`, filling Only Documents causes the workflow search to fail; remove block-only fields before returning the tool payload.</violation>
</file>
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
Summary
organization_delegatedprincipal variant for the executor, minted bycreateExecutorOrganizationPrincipal. It binds the executor delegation first, so the workflow, run and deployment are re-validated. It then requires a Sim user subject and takes the organization from the workflow's workspace, never from tool input. A run with no person (schedule, webhook, workspace API key, external chat sender) fails with the existingsubject_user_requiredfault.authorizeOrganizationOperationgets an executor branch: lifetime capped at the executor delegation TTL (now one shared constant in@sim/auth), andworkflowId/workspaceIdscope required.executoris admitted on the organization forms ofknowledge.search,knowledge.documents.read,organization.people.listandorganization.people.get. Knowledge operations now declare their delegated services per operation.organization) with operationssearch,read_documentandsearch_people. These run the toolsorganization_search,organization_read_documentandorganization_search_peoplefrom the internal tool family inlib/internal/organization-search/. Adding an operation means adding a tool id, a handler, a tool config and a block option.search/read_documentimplementations moved intolib/knowledge/mcp/organization-tools.tsso MCP and workflows return the same shape. MCP behavior is unchanged.organization_search_mcp_invocationtool_name check to includesearch_experts,list_my_activityandlist_my_chat_history, ahead of those tools. It swaps the check NOT VALID, then COMMIT, then VALIDATE, the same as 0475.Type of Change
Testing
lib/internal/organization-search/execute-tool.integration.tsruns against real Postgres. It covers a run as the person finding a colleague, a scheduled run being refused, a workflow outside any organization being refused, a non-member being refused, the organization coming from the workflow rather than the context, delegations that are too long-lived or missing workflow/workspace scope being refused, and an operation that doesn't admit workflows refusing them. Each guard was reverted locally and its test went red.lib/knowledge/mcp/server.test.ts,server.protocol.test.ts,lib/internal/principals/executor.test.ts,organization-authorization.test.ts,blocks/blocks.test.ts,registry.server.test.ts,tools/request-transport.test.ts,tools/metadata.test.tsbun run generate,bun run lint,check:migrations,check-block-registry origin/staging,check-canvas-sentences --block=organization, and these audits: tool-effects, boundaries, file-names, comment-hygiene, utils, explicit-any, source-conventions, tool-registry-boundary, test-patterns, integration-catalog, client-boundary, organization-egress. Full type-check and audits are left to CI.Checklist
test-auditauthoring gate)