Skip to content

Keep agent streams running in the background#4028

Open
KingParmenides wants to merge 1 commit into
stakwork:masterfrom
KingParmenides:agent-background-stream-after
Open

Keep agent streams running in the background#4028
KingParmenides wants to merge 1 commit into
stakwork:masterfrom
KingParmenides:agent-background-stream-after

Conversation

@KingParmenides
Copy link
Copy Markdown

Summary

  • start the remote agent /stream/:taskId request from /api/agent using Next.js after() so the run continues after the initiating browser leaves the task page
  • drain the background stream server-side while relying on the existing /api/agent/webhook + Pusher path for persisted messages and UI updates
  • update the task page to stop owning the direct stream when the backend reports backgroundStream: true
  • add an agent API regression covering the after()-scheduled stream request

Bounty: https://people.sphinx.chat/gobounties/id/4316

Verification

  • npm_config_cache=/private/tmp/npm-cache-hive npm ci
  • npm_config_cache=/private/tmp/npm-cache-hive npx eslint src/app/api/agent/route.ts 'src/app/w/[slug]/task/[...taskParams]/page.tsx' src/__tests__/integration/api/agent.test.ts (passes with existing warnings in task page)
  • npm_config_cache=/private/tmp/npm-cache-hive npx vitest run src/__tests__/unit/api/agent-rollback-logging.test.ts
  • npm_config_cache=/private/tmp/npm-cache-hive npm run build (passes with existing dependency/Redis warnings)
  • git diff --check -- src/app/api/agent/route.ts 'src/app/w/[slug]/task/[...taskParams]/page.tsx' src/__tests__/integration/api/agent.test.ts

Note: the targeted integration test file cannot be executed in this local environment because TEST_DATABASE_URL/DATABASE_URL is not configured for integration tests.

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