Skip to content

feat(mothership): let an agent chat list its owner's other live chats for history recall - #9238

Merged
waleedlatif1 merged 5 commits into
stagingfrom
feat/mothership-recall-chats
Oct 20, 2026
Merged

waleedlatif1 merged 5 commits into
stagingfrom
feat/mothership-recall-chats

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds the negotiated recall_chats control kind and POST /api/mothership/chats/recall so an agent chat can list its owner's other live Mothership chats (id, title, updated time), newest first
  • Scoped exactly like the chat itself: same user, same workspace or organization, copilot.use, owner-readable in a workspace, build permission in an organization, and plan chats hidden unless plan mode is enabled
  • Excludes the calling chat, deleted chats and benchmark chats; only a mothership chat in agent or plan mode may ask
  • Sim declares the kind in its poll accepts, so older Sims never receive it and the worker reports it as unsupported
  • Synced contracts from the worker (chat-recall.ts, sim-transport.ts)

Product update (if relevant)

A new chat can recall what the user said in their other chats ("the ledger I pasted yesterday") instead of asking them to paste it again. The worker reads only chats on this list, intersected with its own records, and frames what it reads as a record of another conversation.

Type of Change

  • New feature

Testing

  • 13 use-case tests (scoping, plan gating, org build permission, wrong chat type/mode, exclusions, ordering); every guard verified by mutation
  • Control dispatch test
  • Paired benchmark against the companion worker PR: a new chat recalling exact values only an earlier chat held went 0/6 → 6/6, with no regression on the existing recall tasks

Companion: simstudioai/mothership#759

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)

@vercel

vercel Bot commented Oct 20, 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 20, 2026 3:12am 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.

No issues found across 8 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

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain from this review.

Summary

Adds a way for agent and plan chats to list their owner’s other live chats in the same workspace or organization.

  • Agent chats can find their owner's other live Mothership chats.

Both earlier, unnumbered findings are addressed: real-database query coverage was added, and the unused import was removed. No new actionable issues were found. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Authenticated HTTP request] --> C[readRecallChats]
  B[Negotiated recall_chats control] --> C
  C --> D[Check owner, scope, and current access]
  D --> E[Check chat mode and plan availability]
  E --> F[listRecallChats]
  F --> G[Return IDs, titles, and update times]
Loading

Reviews (3) · Last reviewed commit: "test(mothership): drop an unused import ..." · Reviewed by Greptile

Comment thread apps/sim/lib/mothership/chat/application/read-recall-chats.test.ts Outdated
@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Oct 20, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • ❌ simstudioai/mothership#759 — OPEN, not merged (targets staging) — feat(worker): read back the user's other chats with history search --chats and -

@waleedlatif1
waleedlatif1 force-pushed the feat/mothership-recall-chats branch from 148bb73 to dd5b2bb Compare October 20, 2026 02:47
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile-apps review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

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

Comment thread apps/sim/lib/mothership/chat/application/read-recall-chats.integration.ts Outdated
@waleedlatif1
waleedlatif1 force-pushed the feat/mothership-recall-chats branch from dd5b2bb to 65fa970 Compare October 20, 2026 03:12
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile-apps review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

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

@waleedlatif1
waleedlatif1 merged commit edbf408 into staging Oct 20, 2026
54 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/mothership-recall-chats branch October 20, 2026 03:48

This branch was previously deployed

1 inactive deployment
Preview — 65fa9708 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant