🐛 fix(task-runner): fall back to inbox agent when task has no assignee#14671
🐛 fix(task-runner): fall back to inbox agent when task has no assignee#14671arvinxx wants to merge 1 commit into
Conversation
Previously threw a BAD_REQUEST when a task lacked assigneeAgentId, which broke runs for tasks created without --agent. Now resolves the built-in inbox agent and persists it on the task before executing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11573d68a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## canary #14671 +/- ##
==========================================
- Coverage 66.18% 66.18% -0.01%
==========================================
Files 2897 2897
Lines 253870 253878 +8
Branches 24788 25643 +855
==========================================
Hits 168019 168019
- Misses 85699 85707 +8
Partials 152 152
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
`TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from #14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…me (#14670) * ✨ feat(task): snapshot agent model into task.config at create time Pin the assignee agent's current model/provider into task.config when a task is created so later changes to the agent's default model don't silently affect already-created tasks. On first run, backfill the snapshot for tasks created before this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(task-runner): fall back to inbox agent when task has no assignee `TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from #14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(task): collapse router orchestration into TaskService Move multi-step task verbs out of the TRPC router into `TaskService`: `createTask`, `cancelTopic`, `deleteTopic`, `runReview`, `updateStatus`, `previewSubtaskLayers`, `runReadySubtasks`. The router keeps only input validation + error wrapping; the tool runtime now shares the same `createTask` path (was duplicating the model snapshot + parent resolution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🚨 ci: fix tsgo errors from TaskService extraction `runReadySubtasks` router was rebuilding the `data` payload via a conditional spread, which forced TS to infer a discriminated union that broke `result.data.skipped` access in the integration test. Pass the service result straight through so `skipped` stays a single optional field. Also cast the stubbed `taskService` in the tool runtime unit tests to bypass strict structural typing — same pattern the other dep stubs already use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…me (lobehub#14670) * ✨ feat(task): snapshot agent model into task.config at create time Pin the assignee agent's current model/provider into task.config when a task is created so later changes to the agent's default model don't silently affect already-created tasks. On first run, backfill the snapshot for tasks created before this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(task-runner): fall back to inbox agent when task has no assignee `TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from lobehub#14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(task): collapse router orchestration into TaskService Move multi-step task verbs out of the TRPC router into `TaskService`: `createTask`, `cancelTopic`, `deleteTopic`, `runReview`, `updateStatus`, `previewSubtaskLayers`, `runReadySubtasks`. The router keeps only input validation + error wrapping; the tool runtime now shares the same `createTask` path (was duplicating the model snapshot + parent resolution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🚨 ci: fix tsgo errors from TaskService extraction `runReadySubtasks` router was rebuilding the `data` payload via a conditional spread, which forced TS to infer a discriminated union that broke `result.data.skipped` access in the integration test. Pass the service result straight through so `skipped` stays a single optional field. Also cast the stubbed `taskService` in the tool runtime unit tests to bypass strict structural typing — same pattern the other dep stubs already use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…me (lobehub#14670) * ✨ feat(task): snapshot agent model into task.config at create time Pin the assignee agent's current model/provider into task.config when a task is created so later changes to the agent's default model don't silently affect already-created tasks. On first run, backfill the snapshot for tasks created before this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(task-runner): fall back to inbox agent when task has no assignee `TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from lobehub#14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(task): collapse router orchestration into TaskService Move multi-step task verbs out of the TRPC router into `TaskService`: `createTask`, `cancelTopic`, `deleteTopic`, `runReview`, `updateStatus`, `previewSubtaskLayers`, `runReadySubtasks`. The router keeps only input validation + error wrapping; the tool runtime now shares the same `createTask` path (was duplicating the model snapshot + parent resolution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🚨 ci: fix tsgo errors from TaskService extraction `runReadySubtasks` router was rebuilding the `data` payload via a conditional spread, which forced TS to infer a discriminated union that broke `result.data.skipped` access in the integration test. Pass the service result straight through so `skipped` stays a single optional field. Also cast the stubbed `taskService` in the tool runtime unit tests to bypass strict structural typing — same pattern the other dep stubs already use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…me (lobehub#14670) * ✨ feat(task): snapshot agent model into task.config at create time Pin the assignee agent's current model/provider into task.config when a task is created so later changes to the agent's default model don't silently affect already-created tasks. On first run, backfill the snapshot for tasks created before this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(task-runner): fall back to inbox agent when task has no assignee `TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from lobehub#14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(task): collapse router orchestration into TaskService Move multi-step task verbs out of the TRPC router into `TaskService`: `createTask`, `cancelTopic`, `deleteTopic`, `runReview`, `updateStatus`, `previewSubtaskLayers`, `runReadySubtasks`. The router keeps only input validation + error wrapping; the tool runtime now shares the same `createTask` path (was duplicating the model snapshot + parent resolution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🚨 ci: fix tsgo errors from TaskService extraction `runReadySubtasks` router was rebuilding the `data` payload via a conditional spread, which forced TS to infer a discriminated union that broke `result.data.skipped` access in the integration test. Pass the service result straight through so `skipped` stays a single optional field. Also cast the stubbed `taskService` in the tool runtime unit tests to bypass strict structural typing — same pattern the other dep stubs already use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…me (#14670) * ✨ feat(task): snapshot agent model into task.config at create time Pin the assignee agent's current model/provider into task.config when a task is created so later changes to the agent's default model don't silently affect already-created tasks. On first run, backfill the snapshot for tasks created before this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(task-runner): fall back to inbox agent when task has no assignee `TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from #14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(task): collapse router orchestration into TaskService Move multi-step task verbs out of the TRPC router into `TaskService`: `createTask`, `cancelTopic`, `deleteTopic`, `runReview`, `updateStatus`, `previewSubtaskLayers`, `runReadySubtasks`. The router keeps only input validation + error wrapping; the tool runtime now shares the same `createTask` path (was duplicating the model snapshot + parent resolution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🚨 ci: fix tsgo errors from TaskService extraction `runReadySubtasks` router was rebuilding the `data` payload via a conditional spread, which forced TS to infer a discriminated union that broke `result.data.skipped` access in the integration test. Pass the service result straight through so `skipped` stays a single optional field. Also cast the stubbed `taskService` in the tool runtime unit tests to bypass strict structural typing — same pattern the other dep stubs already use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…me (lobehub#14670) * ✨ feat(task): snapshot agent model into task.config at create time Pin the assignee agent's current model/provider into task.config when a task is created so later changes to the agent's default model don't silently affect already-created tasks. On first run, backfill the snapshot for tasks created before this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(task-runner): fall back to inbox agent when task has no assignee `TaskRunnerService.runTask` previously threw `BAD_REQUEST` for any task without `assigneeAgentId`, which broke runs created without `--agent`. Resolve and persist the user's built-in inbox agent instead, surfacing an `INTERNAL_SERVER_ERROR` only if that resolution itself fails. Picked from lobehub#14671 (closes once landed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(task): collapse router orchestration into TaskService Move multi-step task verbs out of the TRPC router into `TaskService`: `createTask`, `cancelTopic`, `deleteTopic`, `runReview`, `updateStatus`, `previewSubtaskLayers`, `runReadySubtasks`. The router keeps only input validation + error wrapping; the tool runtime now shares the same `createTask` path (was duplicating the model snapshot + parent resolution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🚨 ci: fix tsgo errors from TaskService extraction `runReadySubtasks` router was rebuilding the `data` payload via a conditional spread, which forced TS to infer a discriminated union that broke `result.data.skipped` access in the integration test. Pass the service result straight through so `skipped` stays a single optional field. Also cast the stubbed `taskService` in the tool runtime unit tests to bypass strict structural typing — same pattern the other dep stubs already use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
💻 Change Type
🔀 Description of Change
TaskRunnerService.runpreviously threwBAD_REQUESTwhen a task lackedassigneeAgentId, which broke any task created without--agent. Now it resolves the built-in inbox agent for the user and persists it on the task before executing.If the inbox agent cannot be resolved (shouldn't happen in practice), we surface an
INTERNAL_SERVER_ERRORinstead of the previous misleading "use --agent" message.🧪 How to Test
Run a task that was created without an assignee — it should now execute under the inbox agent instead of failing with
BAD_REQUEST.