Skip to content

Route web agent runs through Trigger.dev for all tiers#455

Merged
ross0x01 merged 1 commit into
mainfrom
agent-trigger-web-all-tiers
May 15, 2026
Merged

Route web agent runs through Trigger.dev for all tiers#455
ross0x01 merged 1 commit into
mainfrom
agent-trigger-web-all-tiers

Conversation

@ross0x01
Copy link
Copy Markdown
Contributor

@ross0x01 ross0x01 commented May 15, 2026

Summary

  • Web users on agent mode now use the agent-long Trigger.dev endpoint for both free and paid tiers (previously only free).
  • Desktop (Tauri) keeps the prior gating: only free users hit Trigger.dev; paid desktop users continue to call /api/agent directly.
  • Renames the local guard from isFreeAgent to useTriggerAgent to reflect the new combined tier + environment condition.

Test plan

  • Web, free user, agent mode → request goes to /api/agent-long and resumes via /api/agent-long/resume.
  • Web, paid user, agent mode → request goes to /api/agent-long and resumes via /api/agent-long/resume.
  • Desktop, free user, agent mode → still uses /api/agent-long.
  • Desktop, paid user, agent mode → uses /api/agent and standard reconnect URL.
  • Non-agent modes are unaffected on both web and desktop.
  • Legacy agent-long chats still resume correctly via the stored active_trigger_run_id.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved agent-mode request selection across different environments.
    • Enhanced stream reconnection handling with better trigger condition logic.
  • Chores

    • Updated transport request logic for agent-mode operations.

Review Change Stack

Web users on agent mode now use the agent-long Trigger.dev endpoint
regardless of subscription. Desktop keeps the prior behavior where only
free users hit Trigger.dev.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

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

Project Deployment Actions Updated (UTC)
hackerai Ready Ready Preview, Comment May 15, 2026 0:51am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

The PR updates app/components/chat.tsx to make agent-mode long-stream transport requests conditional on both agent mode and Tauri environment detection. The new useTriggerAgent condition replaces prior "free agent" gating logic in both initial transport selection and reconnect routing.

Changes

Agent-long transport environment gating

Layer / File(s) Summary
Environment-aware agent transport selection
app/components/chat.tsx
Import isTauriEnvironment and update DefaultChatTransport request fetcher to use useTriggerAgent condition (agent mode + non-Tauri environment or free subscription) instead of prior "free agent" check, controlling which long-stream transport path is selected.
Reconnect agent-long resume routing
app/components/chat.tsx
Update prepareReconnectToStreamRequest reconnect logic to apply the same useTriggerAgent condition for agent-long resume endpoint selection, replacing prior "free agent" check while preserving fallback to active_trigger_run_id.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • hackerai-tech/hackerai#452: Adjusts Tauri desktop runtime user agent to restore correct agent-long SSE streaming behavior, complementing this PR's environment-aware transport routing logic.

Poem

🐰 A rabbit hops through transport streams,
with Tauri checks and agent dreams,
Old free-agent rules now fade away,
environment-aware routing saves the day!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Route web agent runs through Trigger.dev for all tiers' accurately summarizes the main change: extending Trigger.dev routing to all web tiers (free and paid), not just free users.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent-trigger-web-all-tiers

Comment @coderabbitai help to get the list of available commands and usage tips.

@ross0x01 ross0x01 merged commit 317ce22 into main May 15, 2026
5 checks passed
ross0x01 added a commit that referenced this pull request May 15, 2026
* Show loading dots while agent run is being kicked off

Trigger.dev cold starts can leave the UI blank for several seconds between
submit and the first streamed chunk. Treat "submitted" the same as "streaming"
for the dots indicator so users get immediate feedback that work started.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Make agent-long Stop close the stream instantly

The custom SSE stream in agent-long-transport ignored init.signal, so
useChat.stop() couldn't break out of the trigger.dev subscription's
for-await loop until the next chunk arrived (5-10s when the LLM was
mid-step). Thread the signal through and race iter.next() against an
abort promise so the local stream flushes, releases the iterator, and
sends the abort frame in one tick.

Also expand the /api/agent-long/cancel call to every trigger.dev-routed
run (web non-Tauri or Tauri free), matching the routing rule introduced
in #455, and fire it in parallel with stopActiveStream so the cancel
RPC overlaps the Convex cancel/save round-trip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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