Skip to content

feat(issues): issue tracking as a workspace resource - #8692

Open
TheodoreSpeaks wants to merge 5 commits into
stagingfrom
feat/issue-tracking
Open

TheodoreSpeaks wants to merge 5 commits into
stagingfrom
feat/issue-tracking

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Issues as a new workspace resource behind the issues feature flag (ISSUES env fallback): a title, a markdown document, priority, owner, linked resources and Linear/Jira tickets, and an activity log with comments
  • Three statuses tied to Sim chats: inbox → in_progress (a Sim chat is working on it) → done (completed / dismissed / duplicate). Starting an issue kicks off a chat in the background with no redirect; the issue shows live while the chat runs
  • Keys are SIM-<n>, numbered per organization
  • The body is a workspace file with context = 'issue'. It reuses collaborative editing, versions and streamed writes, but like chat uploads it never appears as a file:
    • excluded from listings, search, forks, rename, move, delete, restore and share
    • content reads/writes, versions, the live editor and the serve route opt in explicitly
    • one policy check on every opt-in: the issues flag, and the same principal kinds the issue operations allow (no workspace API keys)
  • Sim sees a body as issues/<KEY>.md (read and edit only). New issues management tool (create / get) with an issues entitlement; the matching Mothership change is a separate PR
  • Issues page and detail view, plus an Issues tab in Chat. ChipDropdown gains selectedLabel (multi-select) and showSelectedIcon (single-select)
  • Internal API under /api/workspaces/[id]/issues/**, plus public v2 POST /api/v2/issues and GET /api/v2/issues/{issueKey} with OpenAPI docs. The v2 issue operations stay out of the sim CLI while the flag rolls out
  • Migration 0400_issue: new issue, issue_counter, issue_event, issue_resource, issue_external_link tables and copilot_chats.issue_id. The FK is added NOT VALID (the column is new and empty), the index is built concurrently, and a trigger sends an in-progress issue back to the inbox when its chat is detached or deleted

Type of Change

  • New feature

Testing

  • Lifecycle checked end to end against local Postgres (create → start → review → approve/request changes → close → reopen, comments)
  • Issue-body access checked against local Postgres:
    • hidden from listings
    • readable and editable by session and by issues/<KEY>.md
    • served by storage key
    • refused for workspace API keys, rename and delete (by id and by path)
  • repository.integration.ts covers numbering, fingerprint dedupe and the chat-detach trigger
  • bun run lint, bun run check:audits, check:migrations origin/staging, docs-manifest and block-registry checks pass; type-check left to CI
  • Known follow-ups: account deletion is blocked for a user who filed an issue (issue.body_file_id FK); issue documents don't stream into the issue tab yet

Checklist

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01SugAVqYZM3k4tmFJv6xWEN

@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 6, 2026 9:24pm UTC

Request Review

@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.

1 issue found across 117 files

Confidence score: 5/5

  • The body schema in apps/sim/lib/api/contracts/mothership-issues.ts allows 1 MiB of characters, but createIssue enforces a 1 MiB UTF-8 byte limit, so multibyte text can pass schema validation and then be rejected. Align the schema limit with the byte-based check.
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/lib/api/contracts/mothership-issues.ts">

<violation number="1" location="apps/sim/lib/api/contracts/mothership-issues.ts:16">
P3: The schema bounds `body` by character count (`1024 * 1024` chars), but `createIssue` enforces the limit as UTF-8 bytes: `Buffer.byteLength(input.body, 'utf-8') > MAX_BODY_BYTES` with `MAX_BODY_BYTES = 1024 * 1024` in `apps/sim/lib/issues/application/issues.ts`. A body of multi-byte characters (CJK, emoji) under 1M chars can exceed 1 MiB, pass this contract, then fail at write time with "The issue body is larger than 1 MB". Bound the body by bytes so the contract matches enforcement.</violation>
</file>

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/app/workspace/[workspaceId]/issues/components/issue-detail.tsx Outdated
Comment thread apps/sim/lib/collab-doc/seed.ts
Comment thread packages/db/migrations/0400_issue.sql
Comment thread apps/sim/lib/issues/repository.ts Outdated
Comment thread apps/sim/lib/uploads/shared/types.ts
Comment thread apps/sim/app/workspace/[workspaceId]/issues/components/issue-properties.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/issues/[key]/page.tsx Outdated
Comment thread apps/sim/lib/api/contracts/mothership-issues.ts
Comment thread apps/sim/lib/issues/application/issues.ts Outdated
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical risk] Adds public API endpoints and database operations for a new workspace resource type.

The changes since the last review appear safe to merge.

What we checked:

  • Old review changes new work: Both actions now pass the previously read workingChatId. The database update requires that exact chat, so replacing it makes the update fail.

Summary

Adds workspace issues behind the issues flag, with file-backed documents, linked resources, comments, and Sim chats.

  • Adds internal and public APIs, issue pages, and database tables.
  • Since the last review, approveIssue and requestIssueChanges now check the exact workingChatId read before updating.
  • No new actionable findings were identified.
  • TheodoreSpeaks explicitly deferred account deletion for issue creators and streamed document updates in the issue tab.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  New[New issue] --> Start[Start linked Sim chat]
  Start --> Work[In progress]
  Work --> Review[Inbox awaiting review]
  Review --> Approve[Approve and close]
  Review --> Changes[Request changes]
  Changes --> Work
  Approve --> FollowUp[Reopen and start follow-up]
  FollowUp --> Work
Loading

Reviews (8) · Last reviewed commit: "fix(issues): approve and request changes..."

Comment thread apps/sim/lib/mothership/tools/server/issues.ts
Comment thread packages/db/migrations/0400_issue.sql
Comment thread apps/sim/lib/issues/repository.ts Outdated
Comment thread apps/sim/hooks/queries/issues.ts Outdated
Comment thread apps/sim/lib/issues/repository.integration.ts Outdated
Comment thread apps/sim/lib/collab-doc/seed.ts
Comment thread apps/sim/app/workspace/[workspaceId]/issues/components/issue-activity.tsx Outdated
Comment thread apps/sim/lib/workspace-files/application/resolve-workspace-file-reference.test.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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.

1 issue found across 124 files

Confidence score: 3/5

  • apps/sim/lib/issues/repository.integration.ts passes a schema-name string where Drizzle expects table definitions, so the integration test setup fails before any cases run. Pass the imported schema module under a distinct alias.
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/lib/issues/repository.integration.ts">

<violation number="1" location="apps/sim/lib/issues/repository.integration.ts:60">
P2: This passes the dynamic schema-name string as Drizzle's relational `schema` config, which expects table definitions, so the test setup fails before its cases run. Pass the imported schema module under a non-shadowed alias, or omit the config if relational queries are not needed.</violation>
</file>

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/issues/application/issues.ts Outdated
Comment thread apps/sim/app/api/mothership/chats/[chatId]/route.ts
Comment thread apps/sim/app/workspace/[workspaceId]/issues/components/issue-activity.tsx Outdated
Comment thread apps/sim/lib/issues/repository.ts
Comment thread apps/sim/lib/mothership/chat/post.ts
Comment thread apps/sim/app/workspace/[workspaceId]/issues/issues.tsx Outdated
Comment thread apps/sim/lib/issues/repository.integration.ts
Comment thread apps/sim/lib/api/contracts/v2/openapi/resources.ts Outdated
Comment thread apps/sim/lib/api/contracts/v2/openapi/resources.ts Outdated
Comment thread apps/sim/lib/issues/repository.integration.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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.

All reported issues were addressed across 125 files

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

Fix all with cubic | Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/issues/repository.ts
Comment thread apps/sim/lib/issues/application/issues.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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.

All reported issues were addressed across 127 files

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

Fix all with cubic | Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/issues/repository.ts
Comment thread apps/sim/lib/issues/application/issues.ts
Comment thread apps/sim/lib/workspace-files/application/workspace-file-context.ts Outdated
Comment thread apps/sim/lib/issues/application/issues.ts
Comment thread apps/sim/hooks/queries/issues.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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.

All reported issues were addressed across 127 files

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.

Fix all with cubic | Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/issues/repository.ts Outdated
Comment thread apps/sim/hooks/queries/issues.ts
Comment thread apps/sim/app/workspace/[workspaceId]/issues/components/issue-detail.tsx Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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.

All reported issues were addressed across 127 files

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.

Fix all with cubic | Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/issues/application/issues.ts
Comment thread apps/sim/lib/issues/application/issues.ts
Comment thread apps/sim/app/workspace/[workspaceId]/issues/components/issue-detail.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/issues/issues.tsx Outdated
Comment thread apps/sim/hooks/queries/issues.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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.

All reported issues were addressed across 127 files

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.

Fix all with cubic | Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/issues/application/issues.ts Outdated
Comment thread apps/sim/lib/issues/application/issues.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks 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 127 files

Confidence score: 5/5

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

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

This branch was previously deployed

1 inactive deployment
Preview — 6e4a683f Deployed Oct 6, 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