Repository navigation
Conversation
Forward denied document scopes through RealtimeProvider so content loaded before reconnection is cleared after access is revoked. Wait for keyboard sensor readiness and scope Analytics and Inbox locators to accessible content. Cover connection races and persisted drag state.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
|
Thanks for your first pull request to Orbit. Two things that will save you a review round: A maintainer will review this shortly. Ask anything on the thread. |
|
This can be something amazing; you are basically adding an agent directly to Orbit. Is there a design doc? |
Initialize unit databases through release migrations and isolate package lanes. Keep Next on its Node shebang when Playwright runs under Bun. Assign HTTP MCP tokens at their effective authorization stages.
|
My ultimate goal is to let agents join a team’s existing workflow through MCP and become real collaborators in Orbit. The team should be able to see who is doing the work, which human remains responsible for the outcome, when help is needed, and which results need review. Both design documents are now included in the latest PR update: Yodu offers useful ideas around work handoffs, visibility into blockers, result review, and separating authorization from execution. I’d like to learn from those ideas as Orbit’s agent collaboration model develops. For Orbit, I’d keep agent execution in external runtimes, while Orbit handles tasks, permissions, accountability, and human-agent collaboration. The first step is members bringing their own Personal Agents through MCP. The owner controls delegation, and the first version does not support other members directly invoking someone else’s agent. Later, I’d like to explore team-shared Workspace Agents, execution sessions, progress updates, and requests for human input. These need separate design and agreement with you. I’m not assuming they are already approved or part of the current PR’s scope. Does starting with owner-operated Personal Agents over MCP fit the scope you have in mind for #215? I’d like to confirm that first-stage boundary with you, while leaving shared Workspace Agents and execution orchestration for separate proposals. English isn’t my strong suit, so I used GPT to help translate this reply. |
imshashank
left a comment
There was a problem hiding this comment.
Thanks for the design docs, they made this much easier to review. Here is an early pass, since you asked for one on the draft.
What already looks right. The core permission model matches what we agreed on #215. Issue writes re-read the member, the agent identity and the grant FOR UPDATE inside the write transaction, then check through policy. So an owner demoted to guest, removed from the team or removed from the workspace takes the agent's write access with them, and there are tests for it. Assigning a personal agent is limited to its owner or the agent itself, across web create, PATCH and bulk. Tenant isolation is backed by a composite FK. The lock order is consistent, and the pause-vs-create and token-refresh races have real two-connection tests. Nice work.
What would break production today. These matter more than any code-level detail, because each one hits every existing user while all four feature gates are still off:
-
The migration breaks issue creation on the code that's deployed. We run
db:releaseagainst production before merging, so main's code runs on the new schema for a while.issue_creator_actor_checkrequires exactly one ofcreator_user_idandcreator_agent_id, but main only writescreator_id, and the migration has a one-time backfill with no trigger keeping the columns in sync. In that window, every issue create fails the check, including each new workspace's starter issues. Droppingmcp_grant_client_user_uniquealso breaks main's consent upsert, which conflicts on(client_id, user_id). This needs an expand/contract split: nullable actor columns and dual-write or compat triggers first, then the CHECKs and the drops in a later migration once the new code is live. -
Every MCP connection drops on deploy, and nobody can reconnect while the gates are off. The migration revokes every grant without an
agent_identity_id, which is every existing grant, and deletes their access tokens. Meanwhile the consent page shows "invalid or expired" unlessagent_identity_readandagent_consentare both on, andfinalizeMcpConsentrefuses in the same case. So every Claude and ChatGPT connection breaks on deploy and stays broken until we flip the gates. Legacy grants need to keep working until consent is switched on, and revoking them should be a separate, announced step. -
MCP issue writes are refused for everyone with gates off. Every connection is now built as
'agent', andsupport.tsrefuses agent issue writes unless all the gates are on, socreate_issueandupdate_issuestop working for every current user.move_to_cycleis in the mutation list but missing from the agent allowlist, so it stays blocked even with the gates on. -
Human issue writes now always go through the outbox, gate or not. That changes main's behaviour in three ways:
publishreturns before it stampsoriginClientId, so a tab's own echo arrives as a foreign change, which risks flicker and overwritten optimistic edits next to #479's undo.- With the gate off, the cron route returns 503 every minute and nothing retries a failed delivery, so a Redis blip loses the event for good.
- Delivered rows are never pruned.
Please keep the human path untouched until the outbox is ready to own it.
Design questions for me rather than for you:
- The PR rewrites CLAUDE.md to make a persistent outbox worker mandatory. Orbit ships as one Vercel project with no long-running process. In-request drain plus the per-minute cron already deliver on Vercel, so I would rather the worker be optional (self-host only) than required, and keep CLAUDE.md's deployment section as it is.
- #455 adds a generic idempotency table for every MCP write tool, and this PR adds its own for
create_issue. Doing it inside the transaction, as you do, is stronger for creates, but we shouldn't ship two. Let's settle which one wins before either merges.
Things main has moved on since.
- Merging main now conflicts in
issue-service.ts,tools/issues.tsanddocs/mcp.md. - #508 just added
create_sub_issuesandbulk_update_issues, which takeassigneeId, so they need the agent context too. mark_issue_duplicateisn't inISSUE_MUTATION_TOOLSand runs as the human. You already flagged that.- Your migration is
0030, which collides with open PRs #448 and #485, so it will need regenerating against whatever lands first.
Suggested split. 35k lines in one PR is too much to review safely. Something like:
- Expand-only schema with dual-write: no CHECKs, no credential changes.
- The canonical actor reader, plus client schema and UI rendering.
- Identity, consent and grant binding, with legacy grants still working.
- Agent issue writes and responsibility, including
move_to_cycle,mark_issue_duplicateand the #508 bulk tools. - The outbox on its own.
- The contract migration.
Each of those can merge and deploy safely on its own. Happy to talk through the order on #215.
| CREATE INDEX "issue_owner_user_idx" ON "issue" USING btree ("owner_user_id");--> statement-breakpoint | ||
| CREATE INDEX "issue_activity_assignee_attribution_idx" ON "issue_activity" USING btree ("organization_id","issue_id","created_at") WHERE "issue_activity"."field" = any (array['assigneeId', 'assignee']);--> statement-breakpoint | ||
| ALTER TABLE "mcp_grant" ADD CONSTRAINT "mcp_grant_active_binding_check" CHECK (("mcp_grant"."revoked_at" is null and "mcp_grant"."agent_identity_id" is not null and "mcp_grant"."user_id" is not null) or ("mcp_grant"."revoked_at" is not null and ("mcp_grant"."agent_identity_id" is not null or ("mcp_grant"."revoke_reason" is not null and "mcp_grant"."revoke_reason" = 'agent_identity_required'))));--> statement-breakpoint | ||
| ALTER TABLE "issue" ADD CONSTRAINT "issue_creator_actor_check" CHECK (("issue"."creator_user_id" is not null and "issue"."creator_agent_id" is null) or ("issue"."creator_user_id" is null and "issue"."creator_agent_id" is not null));--> statement-breakpoint |
There was a problem hiding this comment.
Main's code only writes creator_id, and there's no trigger keeping creator_user_id in sync after the one-time backfill above. So once this migration is on production (we run it before merging), every issue create from the deployed code fails this check. Please move the CHECKs to a later contract migration and dual-write in the meantime.
| --> statement-breakpoint | ||
| ALTER TABLE "mcp_grant" ALTER COLUMN "principal_name_snapshot" SET NOT NULL; | ||
| --> statement-breakpoint | ||
| UPDATE "mcp_grant" |
There was a problem hiding this comment.
This revokes every existing grant, since none has an agent_identity_id yet, and the DELETE below removes their tokens. With the consent gates off by default, nobody can reconnect afterwards. Legacy grants need to keep working until consent is enabled, then be revoked in a separate step.
| if ( | ||
| consentCode === undefined || | ||
| !agentFeatureEnabled('agent_identity_read') || | ||
| !agentFeatureEnabled('agent_consent') |
There was a problem hiding this comment.
With the gates off (the default), this shows "invalid or expired" to everyone. Combined with the migration revoking every grant, it means no user can reconnect their AI client after deploy.
| identity.principal, | ||
| identity.scopes, | ||
| workspaceInstructions, | ||
| 'agent', |
There was a problem hiding this comment.
Every connection is built as an agent, so with the gates off support.ts refuses create_issue and update_issue for every current user. Unbound legacy grants should keep the human path until agent writes are enabled.
|
@imshashank |
|
Closing this since it has been split into #516, #523, #524 and #525 as agreed, and the open threads here are being answered in those. #516 is approved and goes in once the production release is run. Please keep the design docs linked from the split PRs so the discussion is not lost. Generated by Claude Code |
What this changes
This is a Draft PR for early review of the Agent identity, data model, permission boundaries, and Issue runtime implementation. It is not ready to merge and does not claim to complete #215. Known Web integration gaps and remaining work are listed below.
Adds workspace Agent identities that can be assigned issues through MCP and appear as the actor for Issue mutations. The authorizing Human remains the permission principal, so Agent access is the intersection of the grant scopes, the Human's current permissions, and resource policy.
create_issuesupports idempotency keys, and public events omit grant identifiers.Why
MCP actions currently appear to come from the authorizing person, and Agents cannot own an assignment queue. This work establishes the runtime and permission boundaries needed to make Agent work visible and assignable without granting additional access. This draft requests upstream feedback before completing the remaining UI integration.
Refs #215
Design documents
The implementation document describes existing behavior and incomplete workflows. The target document proposes Personal Agents as the first milestone; shared Workspace Agents and execution orchestration require separate design and maintainer agreement.
Feedback requested
Known gaps and remaining work before ready for review
creator,assignee,owner,assigneeAgentId, andownerIdin the client Issue schema and update detail, list, and board consumers. Agent assignments currently render as Unassigned, and the Human Issue Owner has no display or transfer controls.ownerUserId: nullfor policy-controlled Owner clearing when there is no Agent Assignee. The current validator and transfer path do not support that input.How you know it works
Latest local repair validation (2026-10-02)
Candidate:
7d4dced5e1a8d260bc84deb3ce7d9d16502955ed. Repairs address the CodeQL dead token assignment, release-based CI database setup with isolated lanes, and the Next Node runtime during Bun-launched Playwright cold starts.bun run verify7d4dcedbun run test:e2ed8abd45bun run test:e2e:agent-released8abd45d8abd45d8abd457d4dcedgit diff --check7d4dcedAfter
d8abd45, only two unit test files changed. Browser, MCP, Inbox, build, and documentation results retain their actual execution SHA rather than being presented as final-SHA reruns. The final verification ran on Linux with Bun 1.3.14 and Node 22.23.3.Hosted CI and the CodeQL rescan still need remote confirmation. The separate
test:docker-gatewayCI step was not run locally. The exact CI MinIO image could not be pulled; browser validation used cached MinIORELEASE.2025-09-07T16-13-09Z, while unit S3 tests used LocalStack with signature validation enabled. These results do not claim production validation or completion of the workflow gaps above.Earlier baseline validation
Validated on
203a066dcba7c7ffc4adcb5a28e81749f3392e79, including upstreamd133153ef077637324f0eb34b79fbc82f45b1212.bun run verifybun run test:e2ebun run test:e2e:agent-releasedb:release, repeated release, anddb:check-driftbun run build,bun run docs:build, documentation navigation testgit diff --checkThe regression coverage includes current-permission checks, identity lifecycle races, exact credential binding, Actor constraints and backfills, issue attribution, Agent queue access, idempotency, Outbox delivery and redaction, and real HTTP OAuth/MCP behavior with the Writer enabled and disabled.
The browser coverage also includes document access revoked during a reconnect, keyboard drag readiness and persistence, and Agent settings and Inbox behavior. The full verification includes real S3 round trips with signature validation enabled. The earlier persistent Worker image and recovery drill was not repeated for this merge candidate; it remains historical evidence, not a new result.
These passing results describe the current test suite, not complete coverage of #215. The existing MCP browser test checks the generic Agent Creator label and Activity badge, but does not assert Agent Assignee rendering, Human Owner controls, or Web Agent selection. Those gaps remain despite the green suite.
Screenshots
Before this change, MCP settings listed Human-authorized client connections without an Agent management surface, and MCP issue actions appeared to come from the Human.
After this change, settings show Agent identities, owners, lifecycle and connection state, locks, permissions, quota, and recent activity. Issue activity distinguishes the Agent actor from its Human principal.
Light and dark screenshots of Agent settings and issue attribution have been captured in the local review bundle. Uploading the four PNGs to this PR is pending. They use synthetic E2E data, not production records.
The screenshots cover existing Settings and Activity behavior only. They are not evidence that the Agent Assignee and Human Owner UI is complete.
Checklist
bun run verifyis green, all four checksany, no non-null assertions@orbit/sharedpackages/shared/src/policy, including the remaining lifecycle action checksbun run db:releaseandbun run db:check-driftpassed against the target database before this ships. The isolated acceptance target passed; the deployment target remains a release-time check.Anything reviewers should know
0030_green_shaman.sqlappends to the official migration chain. Existing upstream migrations are unchanged. The abandoned local development migration lineage is not a supported upgrade path.meandlist_my_issueskeep their Human meanings;agentandlist_agent_issuesrefer to the current Agent. Agent attribution covers issue mutations; comments, attachments, and documents retain Human attribution.