Skip to content

fix(organization-search): refuse runs resumed by someone else, single-source operations, surface-neutral shared tools - #10562

Merged
waleedlatif1 merged 8 commits into
stagingfrom
fix/organization-search-followups
Dec 1, 2026
Merged

waleedlatif1 merged 8 commits into
stagingfrom
fix/organization-search-followups

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-ups to the Organization Search workflow block (#10534):

  • Resume steering. Organization reads act as the person who started a run, but a human-in-the-loop resume could be driven by anyone allowed to resume, including a workspace API key.
    • enqueueOrStartResume now records the resumer ({ subjectUserId }, null for a workspace key) on the pause point, so queued and background attempts read it back. The resume carries it as metadata.resumedBy and executorDelegationOrigin.resumedBy.
    • createExecutorOrganizationPrincipal refuses a run resumed by anyone other than its person.
    • Once someone else has resumed a run, that stays on the run for later segments, including timer resumes. Timer resumes record no one and continue the run as is.
  • Log visibility. The block and tool descriptions now say that results are returned to the workflow and appear in its run logs, which other workspace members can read.
  • Docs. organization is in NATIVE_RESOURCE_BLOCK_TYPES, so docsLink resolves; the integrations page is generated.
  • Document IDs are split on newlines only, so a link holding a comma (a JQL URL) stays whole.
  • One operation list. ORGANIZATION_SEARCH_OPERATIONS in lib/internal/organization-search/tool-ids.ts now drives the block dropdown, tools.access, the tool ids and the internal tool registry, for all five operations. Its comment lists every step for adding one.
  • Contract descriptions. Tool parameter descriptions come from the zod contracts. The "covers only this organization's people" line and the live.notes/live.accounts flag explanation are back.
  • Surface-neutral shared tools. organization-tools.ts moved from lib/knowledge/mcp/ to lib/knowledge/application/, and read-budget.ts moved to lib/knowledge/search/. callerErrorMessage now uses messageForOrchestrationError instead of the v2 presenter. A parity test confirms the MCP messages are unchanged.
  • Search check. The handler-level check is now only on search_people, since live search, read, activity and chat history already check it in their use cases. organizationDelegatedServices is dropped from DeniedKnowledgeDelegation.
  • Hiding the block. resolveIntegrationAccess denies organization when the host's features.organizationSearch is false, the same way it hides credential_group. The server-side check is unchanged.
  • Workflow rate limits (not changed). Workflow calls do not pass through the Search MCP's per-API-key v2 rate bucket. That bucket is a public-API control keyed by API key or OAuth token. Moving it into the shared use case would also throttle the Assistant and Slack Search, which have their own turn limits. Workflow calls are already bounded by execution limits, per-account search deadlines and provider rate limits.
  • Mothership: nothing needed.

Type of Change

  • Bug fix

Testing

  • lib/internal/organization-search/execute-tool.integration.ts covers:
    • a run resumed by another member, or by a workspace key, is refused; a run resumed by its own person is allowed
    • an external-user webhook run and a workspace-key run are refused
    • knowledge search and read accept a workflow run in their organization form, and a knowledge operation that doesn't admit workflows refuses it
    • a run secret in a query is projected out of the directory result
    • an organization without Search is refused
  • lib/workflows/executor/pause-persistence.integration.ts: the resumer is recorded for a resume that starts and for one that waits in the queue.
  • Unit tests: lib/knowledge/application/organization-tools.test.ts (parity with the v2 messages), tools/organization/utils.test.ts, lib/integrations/access.test.ts, and the resume route test, which now expects the resumer to be recorded.
  • Guards reverted locally and went red: the resumer check, secret projection, and newline-only splitting.
  • 4,842 related unit tests pass; bun run generate and lint; audits: tool-effects, boundaries, file-names, comment-hygiene, utils, explicit-any, source-conventions, test-patterns, tool-registry-boundary, actorless-executor-operations, tool-request-boundary, api-validation:strict, client-boundary, integration-access, canvas-sentences, integration-catalog, organization-egress.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Dec 1, 2026 9:50am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; the completed-branch fix closes the previously reported gap.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the completed-branch fix closes the previously reported gap.

Summary

Organization Search now refuses reads after another person or a workspace key resumes a run.

  • Organization Search refuses runs resumed by someone other than their starter.
  • The Organization Search block disappears when the host workspace feature is off.
  • Search MCP and workflows share the same organization search and read tools.
  • Organization Search tools share one operation list and clearer guidance.
  • Document ID text keeps commas inside links intact.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Resume a pause] --> B[Read saved and completed-point resumers]
  B --> C{Did someone else resume?}
  C -->|Yes| D[Keep that resumer for later segments]
  C -->|No| E[Use the current or saved resumer]
  D --> F[Organization Search refuses the read]
  E --> G[Organization Search checks the run's person]
Loading

Reviews (2) · Last reviewed commit: "fix(resume): keep a member's resume acro..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@blacksmith-sh

This comment has been minimized.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 42 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

This branch was successfully deployed

1 active deployment
Preview — dd8df00e Deployed Dec 1, 2026 by vercel[bot]
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