feat(chat): add scheduled tasks as a viewable resource#5085
feat(chat): add scheduled tasks as a viewable resource#5085waleedlatif1 wants to merge 4 commits into
Conversation
Adds a new `scheduledtask` resource type so a scheduled task can be opened and viewed as a tab in Chat: - registry config (Calendar icon, label, tab/dropdown renderers) - add-resource dropdown listing (workspace jobs) - embedded detail viewer (status, schedule, next/last run, prompt, recent runs) - "Open in scheduled tasks" action + query invalidation - contract enum + route validation so the resource persists Agent-side mention/OpenResource wiring is left as a follow-up.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview End-to-end wiring: API contract and chat-resources route accept and persist the type; shared UI: Add-resource dropdown lists schedules ( Reviewed by Cursor Bugbot for commit 9c07fd9. Configure here. |
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge — purely additive feature wiring that follows the exact same pattern used by all other resource types, with no changes to shared execution paths. Every touchpoint — Zod contract, route allowlist, persistence dedup, type guard, clipboard codec, context registry, resource registry, and embedded viewer — is updated consistently. Error and loading states were addressed in a prior commit (e494b22). The shared GENERIC_RESOURCE_TITLES refactor is a strict equivalence substitution. No pre-existing paths are altered. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User opens Add Resource dropdown] --> B[useWorkspaceSchedules]
B --> C{Filter sourceType === 'job'}
C --> D[Show scheduled tasks list]
D --> E[User selects a scheduled task]
E --> F[POST /api/copilot/chat/resources\ntype: 'scheduledtask']
F --> G{copilotResourceTypeSchema\nvalidates 'scheduledtask'}
G --> H{VALID_RESOURCE_TYPES\ncheck passes}
H --> I[persistChatResources\nGENERIC_RESOURCE_TITLES dedup]
I --> J[Resource stored in chat.resources]
J --> K[Tab rendered via RESOURCE_REGISTRY]
K --> L[EmbeddedScheduledTask]
L --> M{useWorkspaceSchedules}
M -->|isLoading + no data| N[Loading skeleton]
M -->|isError| O[Error state — Try again]
M -->|not found| P[Not found state]
M -->|found| Q[Render status / schedule / runs]
Q --> R[EmbeddedScheduledTaskActions]
R --> S[router.push scheduled-tasks page]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User opens Add Resource dropdown] --> B[useWorkspaceSchedules]
B --> C{Filter sourceType === 'job'}
C --> D[Show scheduled tasks list]
D --> E[User selects a scheduled task]
E --> F[POST /api/copilot/chat/resources\ntype: 'scheduledtask']
F --> G{copilotResourceTypeSchema\nvalidates 'scheduledtask'}
G --> H{VALID_RESOURCE_TYPES\ncheck passes}
H --> I[persistChatResources\nGENERIC_RESOURCE_TITLES dedup]
I --> J[Resource stored in chat.resources]
J --> K[Tab rendered via RESOURCE_REGISTRY]
K --> L[EmbeddedScheduledTask]
L --> M{useWorkspaceSchedules}
M -->|isLoading + no data| N[Loading skeleton]
M -->|isError| O[Error state — Try again]
M -->|not found| P[Not found state]
M -->|found| Q[Render status / schedule / runs]
Q --> R[EmbeddedScheduledTaskActions]
R --> S[router.push scheduled-tasks page]
Reviews (3): Last reviewed commit: "feat(chat): wire scheduledtask chat-cont..." | Re-trigger Greptile |
…sistence
Dedupes the placeholder-title set that the chat-resource route and the
server-side persistence merge each defined separately. They had already
drifted ('Log' was missing from persistence); a single shared
GENERIC_RESOURCE_TITLES keeps title-upgrade behavior consistent, including
the new 'Scheduled Task' placeholder.
…task viewer - Render a 'couldn't load' state when the schedules query errors, instead of falsely claiming the task was deleted (uses React Query isError) - Use a stable composite key for jobHistory rows so same-second timestamps don't collide
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e494b22. Configure here.
Adds a first-class 'scheduledtask' ChatContext kind so a scheduled-task resource maps to a real context (not a generic docs fallback), fixing the exhaustive RESOURCE_TO_CONTEXT map that broke the build: - ChatContext union + CHAT_CONTEXT_KIND_REGISTRY (Calendar chip) - resource→context mapping, context validity check, clipboard portability Agent-side consumption of the kind remains a follow-up.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 9c07fd9. Configure here.
Summary
scheduledtaskresource type so a scheduled task can be opened and viewed as a tab in Chat (we had no way to view one before)Agent-side mention/OpenResource wiring is intentionally left as a follow-up.
Type of Change
Testing
Tested manually.
tsc,check:api-validation, andcheck:react-queryall pass.Checklist