Skip to content

Stop the agents run route from reporting a run that never happened - #324

Open
joei4cm wants to merge 1 commit into
CopilotKit:mainfrom
joei4cm:fix/218-agent-run-not-queued
Open

joei4cm wants to merge 1 commit into
CopilotKit:mainfrom
joei4cm:fix/218-agent-run-not-queued

Conversation

@joei4cm

@joei4cm joei4cm commented Dec 3, 2026

Copy link
Copy Markdown

Closes #218.

POST /api/agents/[id]/run answered 202 with status: 'queued' and stamped the agent's lastRun, but nothing in the queue or the worker reads Agent rows — no job was queued and no agent ran. The 202, the queued status and the fresh timestamp were three independent signals that the agent ran; none of them was true.

This takes the issue's option 2:

  • The route now answers 501 with an explanation, and no longer writes lastRun.
  • The Run button is disabled, and the Agents page says manual runs are not available yet — the same wording the Email Templates page uses for its own unwired feature (see outpost#226).

Option 1 (a real AGENT_RUN job type and a worker handler) is a larger piece of work and is left for a separate decision. The run button comes back with it: AgentActions/AgentTable take a runsAvailable prop that defaults to unavailable, so a consumer that forgets it gets a disabled button rather than a dead end.

Agents stamped by the old route keep their old lastRun values; clearing those is a data change and is left out of this PR.

Tests:

  • apps/web agents API and component suites — 48/48 passed. The new tests (the route reports no run and does not touch lastRun; the run button is disabled by default and enabled only when runs are available) fail on the previous implementation.
  • Full apps/web suite — 1216 passed, 26 skipped, 0 failed
  • apps/web typecheck, ESLint, Prettier, git diff --check passed
  • Built-in medium code-review fallback, authorized by the user because copilotkit-internal:cr-loop is unavailable; its findings (the disabled default for runsAvailable, the tooltip that disabled buttons never show, and the untested AgentTable pass-through) are addressed.

🤖 Generated with Claude Code

POST /api/agents/[id]/run answered 202 with status 'queued' and stamped the
agent's lastRun, but nothing reads Agent rows: no job was queued and no
worker ran the agent. The route now answers 501 and says the run did not
happen, and no longer touches lastRun.

The Run button is disabled by default and the Agents page says why, so the
UI stops offering a run that cannot happen.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Agents module: a manual run reports 'queued' and executes nothing

1 participant