fix(slack-work-app): Add thread context in resume link messages - #3132
Conversation
🦋 Changeset detectedLatest commit: 21ae2a0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This public PR was merged directly in the public repo. The matching monorepo PR was left open for manual follow-up because Matching internal PR: #97 |
SummaryWhen a user sends a "resume link" message inside a Slack thread, the agent now receives the surrounding thread context — giving it the same conversational awareness that regular mention-based interactions already have. ChangesThread context for resume-link messages (
|
Thread context for resume-link messagesWhen a user clicks a "resume" link inside a Slack thread, the agent now receives the surrounding thread context — the same context it already gets for regular mention-based interactions. What changed
Both
Adds a mock for
Changeset
|
There was a problem hiding this comment.
Clean, focused change. The getThreadContext integration follows the same pattern used in app-mention.ts and direct-message.ts. isInThread logic, the Promise.all parallelization, and the threadContext || undefined coercion to avoid rendering empty <slack_thread_context> blocks are all correct. The DM path also gets a nice perf improvement by parallelizing the getSlackUserInfo call.
Claude Opus | 𝕏
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
This PR adds thread context support to the resumeMention and resumeDirectMessage functions in the Slack work app. The changes are minimal, well-structured, and follow existing codebase patterns.
What Changed
-
resumeMention(lines 159-179): Added thread context retrieval using the sameisInThreadpattern used elsewhere in the codebase (app-mention.ts,direct-message.ts,block-actions.ts). ThegetThreadContextcall is correctly parallelized with existing async operations viaPromise.all. -
resumeDirectMessage(lines 238-255): Same pattern applied consistently. Previously a singleawaitforgetSlackUserInfo, now correctly parallelized withgetThreadContext. -
Changeset: Appropriate
patchbump for@inkeep/agents-work-apps.
Review Notes
✅ Correctness: The isInThread check (Boolean(intent.threadTs && intent.threadTs !== intent.messageTs)) correctly matches the established pattern in peer files.
✅ Performance: Thread context is fetched in parallel with other async operations, maintaining the existing performance characteristics.
✅ Consistency: The threadContext || undefined conversion properly handles the empty-string-to-undefined transform for the optional threadContext field in FormatSlackQueryOptions.
✅ Edge cases: When not in a thread, Promise.resolve('') is returned, avoiding unnecessary API calls.
✅ APPROVE
Summary: Clean, well-structured bugfix that adds thread context to resume link messages in Slack. The implementation follows established patterns perfectly and parallelizes async operations appropriately. Ship it! 🚢
Reviewers (2)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
pr-review-standards |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
pr-review-consistency |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Total | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Preview URLsUse these stable preview aliases for testing this PR:
These point to the same Vercel preview deployment as the bot comment, but they stay stable and easier to find. Raw Vercel deployment URLs
|
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
This is a re-review scoped to the delta since the last automated review (commit b3d673358).
Delta Review
1 commit (fix test) — 1 file (resume-intent.test.ts, +11/-2)
The delta adds proper test coverage for the thread context functionality that was already approved in the previous review:
- Mock addition (line 57): Added
getThreadContextmock returning sample thread messages - Verification (lines 149-153): Test now verifies
getThreadContextis called with correct channel and thread timestamp - Output assertion (lines 142, 157): Test validates the formatted question includes thread context prefix and that
formatSlackQueryreceives thethreadContextparameter
✅ Correctness: Test assertions correctly verify the thread context integration added in resume-intent.ts
✅ Test pattern: Uses existing mock patterns (vi.fn().mockResolvedValue) consistent with the rest of the test file
✅ Coverage: The test now properly verifies the full thread context flow for the mention entry point
✅ APPROVE
Summary: Clean test fix that completes the thread context feature. The delta correctly adds test coverage for the getThreadContext call and validates the formatted output includes thread messages. Ready to ship! 🚀
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Total | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: No reviewers dispatched — delta is test-only updates that align with already-approved implementation.
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
This is a re-review scoped to the delta since the last automated review (commit 4b9987c98).
Delta Review
1 commit (fix raw query build error) — 1 file (agents-api/tsdown.config.ts, +9/-0)
The delta adds a resolveId hook to the rawQueryPlugin in the tsdown build configuration:
resolveId(source, importer) {
if (!source.endsWith(rawQuery)) return;
const basePath = source.slice(0, -rawQuery.length);
const resolved = importer
? path.resolve(path.dirname(importer), basePath)
: path.resolve(basePath);
return resolved + rawQuery;
}✅ Correctness: The implementation follows standard Rollup/tsdown plugin conventions. It properly:
- Strips the
?rawsuffix to get the base path - Resolves relative paths using
path.dirname(importer)when an importer exists - Falls back to
path.resolve(basePath)for entry points without importers - Re-appends the
?rawmarker for theloadhook to process
✅ Root cause fix: The prior load hook was receiving unresolved relative paths (e.g., ../../../../../../templates/v1/prompt/system-prompt.xml?raw) which fs.readFile cannot resolve. The new resolveId hook ensures absolute paths are passed to load.
✅ Consistency: Aligns with the existing load hook's path handling logic.
✅ APPROVE
Summary: Clean build tooling fix that resolves the ?raw import path resolution issue. The resolveId implementation is correct and follows standard plugin patterns. Combined with the previously-approved thread context feature, this PR is ready to ship! 🚀
Reviewers (2)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
pr-review-devops |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
pr-review-standards |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Total | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
This is a re-review scoped to the delta since the last automated review (commit 114222355).
Delta Review
1 commit (revert tsdown changes) — 1 file (agents-api/tsdown.config.ts, -9 lines)
The delta reverts the resolveId hook that was added in the previous commit (fix raw query build error). This brings tsdown.config.ts back to its state on main, removing an unrelated build tooling change from the PR scope.
✅ Correctness: The revert is clean and complete — the file now matches main. The rawQueryPlugin remains functional with just the load hook, as it was before this PR.
✅ PR scope: The final PR diff now only contains the intended thread context feature:
resume-intent.ts— thread context retrieval for mention and DM resume flowsresume-intent.test.ts— test coverage for the new functionality- Changeset for
@inkeep/agents-work-apps
✅ No regression: The build fix was unrelated to the thread context feature and its removal doesn't affect the core functionality being shipped.
✅ APPROVE
Summary: Clean housekeeping commit that removes an unrelated build tooling experiment from the PR. The thread context feature (previously approved) remains intact. Ready to ship! 🚀
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Total | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: No domain-specific reviewers dispatched — delta is a revert that cleans up PR scope. The core feature was already reviewed and approved in prior review runs.
Ito Test Report ✅14 test cases ran. 14 passed. All 14 test cases passed with zero failures, showing the Slack /link and /work-apps/slack/users/link/verify-token experience is stable on local endpoints across core, edge, resilience, and security coverage. Key findings were successful linking for mention-thread, DM-thread, and backward-compatible non-thread tokens; correct unauthenticated routing with preserved returnUrl and no verification call on bare /link; safe handling of expired/tampered/injection-like tokens; bounded behavior under refresh/replay race and mobile viewport checks; and strong authorization/anti-spoof controls that reject API-key or system identities and bind linking to the authenticated session user. ✅ Passed (14)Commit: Tell us how we did: Give Ito Feedback |
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
This is a re-review scoped to the delta since the last automated review (commit c2aa4a9ecf83).
Delta Review
1 commit (Merge branch 'main' into fix/resume-link-in-thread) — brings in unrelated changes from main (Microsoft SSO feature #3134 + version packages #3131).
The PR's feature files (resume-intent.ts, resume-intent.test.ts, changeset) are unchanged since the prior review. No new code to evaluate.
Prior Review Summary
The core feature was thoroughly reviewed in 4 prior automated reviews, all with 0 findings:
✅ Pattern consistency: The isInThread check (Boolean(intent.threadTs && intent.threadTs !== intent.messageTs)) matches established patterns in app-mention.ts, direct-message.ts, block-actions.ts, and modal-submission.ts.
✅ Performance: getThreadContext is parallelized via Promise.all with existing async operations — no sequential overhead added.
✅ Correctness: The threadContext || undefined coercion properly handles empty-string-to-undefined conversion for the optional threadContext field.
✅ Test coverage: The test correctly verifies getThreadContext is called with the right arguments and that the formatted question includes thread context.
✅ Changeset: Appropriate patch bump for @inkeep/agents-work-apps.
✅ APPROVE
Summary: The delta is a clean merge from main with no changes to the PR's feature code. The thread context implementation (previously approved) follows established Slack event handler patterns perfectly. Ship it! 🚀
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Total | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: No domain-specific reviewers dispatched — delta is a merge commit with no changes to the PR's feature code. The core implementation was already reviewed and approved in 4 prior runs.
Ito Test Report ✅14 test cases ran. 14 passed. Across a unified local non-production run, all 14 test cases passed (0 failed), with core Slack ✅ Passed (14)Commit: Tell us how we did: Give Ito Feedback |
No description provided.