Skip to content

feat(chat): Add transcript query tools#717

Open
dcramer wants to merge 6 commits into
mainfrom
dcramer/feat/slack-transcript-tools
Open

feat(chat): Add transcript query tools#717
dcramer wants to merge 6 commits into
mainfrom
dcramer/feat/slack-transcript-tools

Conversation

@dcramer

@dcramer dcramer commented Jul 1, 2026

Copy link
Copy Markdown
Member

Junior now registers three read-only transcript tools backed by SQL conversation metadata and persisted thread state, so the agent can discover prior Junior conversations without accepting model-supplied workspace, channel, requester, or arbitrary scope selectors.

The tools are:

  • transcriptList: lists visible saved transcripts newest-first, returning the conversation_id needed by the other tools plus destination metadata, display/title fields, activity timestamps, retained message and compaction counts, the latest message excerpt, optional source link, and latest-message event_id/message_offset anchors.
  • transcriptSearch: keyword-searches visible transcripts across retained live messages and compaction summaries. It matches the exact normalized query or all query terms, then returns bounded results with conversation metadata, message or compaction excerpts, author/timestamp details when available, optional Slack permalinks for message hits, and live-message event_id/message_offset anchors for read handoff.
  • transcriptRead: opens one visible transcript by conversation_id from list/search and reads a bounded window of retained live messages. It can start from an event_id with optional context_before, or use offset/next_offset for simple scanning. Compaction summaries and count metadata are included without dumping the whole transcript at once.

Visibility is derived from the active runtime context. Same-workspace public Slack channel transcripts may be visible; private Slack channels and DMs must match the current Slack source or same-workspace destination channel; local transcripts require the exact current local conversation. Each tool supports include_links for best-effort source links and clamps result size to supported limits. event_id is the retained live-message anchor; Slack message timestamps stay separate as source message IDs/links.

This is stacked on #716 so tool execution can assume SQL conversation storage is configured.

Fixes #688

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment Jul 1, 2026 9:11pm

Request Review

Comment thread packages/junior/src/chat/tools/transcripts.ts Outdated
@dcramer dcramer force-pushed the dcramer/feat/slack-transcript-tools branch from 0d151f0 to 8ee2470 Compare July 1, 2026 16:58
@dcramer dcramer changed the title feat(slack): Add transcript query tools feat(chat): Add transcript query tools Jul 1, 2026
Comment thread packages/junior/src/chat/tools/transcripts.ts Outdated
Comment thread packages/junior/src/chat/tools/transcripts.ts Outdated
@dcramer dcramer force-pushed the dcramer/feat/slack-transcript-tools branch from 36605d3 to 805632c Compare July 1, 2026 18:02
@dcramer dcramer force-pushed the dcramer/fix/require-junior-database branch from c66e52e to eb8d747 Compare July 1, 2026 18:25
Base automatically changed from dcramer/fix/require-junior-database to main July 1, 2026 18:39
dcramer and others added 2 commits July 1, 2026 11:42
Add transcript list, search, and read tools for SQL conversation metadata.

Read persisted thread state for live messages and retained compaction summaries.

Organize transcript tools and integration coverage as per-tool module files.

Share access, link, dependency, limit, and projection helpers across those tools.

Derive transcript visibility from the current source.

Public Slack channels in the same workspace are visible.

Private, direct, and local transcripts stay limited to the current source identity.

Keep Slack permalinks as best-effort source links instead of Slack-specific tools.

Fixes #688

Co-Authored-By: Codex GPT-5 <noreply@openai.com>
Include the same-workspace Slack destination channel when checking private transcript access.

Page transcript list and search scans through inaccessible rows while preserving the raw scan cap.

Co-Authored-By: Codex GPT-5 <noreply@openai.com>
Transcript tools are read-only and now appear in the advisor's real tool definitions.

Update the integration assertion to include them.

Co-Authored-By: Codex GPT-5 <noreply@openai.com>
@dcramer dcramer marked this pull request as ready for review July 1, 2026 19:39
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 1, 2026
Rename transcript tool implementation modules so their filenames match the registered tool names.

Clarify transcriptRead as a bounded message-window read that agents can page through with offsets instead of treating it like a whole-transcript dump.

Co-Authored-By: Codex GPT-5 <noreply@openai.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8a3d962. Configure here.

return;
}
offset += rows.length;
scannedCount += rows.length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inaccessible rows exhaust scan budget

Medium Severity

visitVisibleTranscripts counts every listByActivity row toward MAX_SCAN_LIMIT before access filtering. In a local runtime, Slack conversations are always rejected by transcriptAccess but still consume the scan budget, so transcriptList and transcriptSearch can return nothing even when the current local transcript exists further down the activity list.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8a3d962. Configure here.

Comment thread packages/junior/src/chat/tools/slack/thread-read.ts
Collapse transcript tool helper modules into a smaller private support surface.

Keep access control isolated, colocate single-use projections with their tools, and preserve transcript list/search/read behavior.

Co-Authored-By: Codex GPT-5 <noreply@openai.com>
Expose retained live transcript messages with event_id and message_offset so list and search results can hand off to transcriptRead. Allow transcriptRead to start from an event_id with optional leading context while preserving offset pagination for scanning.

Co-Authored-By: GPT-5 Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tools to search previous conversation transcripts

1 participant