fix(orchestration): emit the real task status on non-status updates - #12550
Open
pacocartones wants to merge 2 commits into
Open
fix(orchestration): emit the real task status on non-status updates#12550pacocartones wants to merge 2 commits into
pacocartones wants to merge 2 commits into
Conversation
`updateCloudAgentTask` published `state: "updated"` on `agent.task.updated` whenever the update carried no `status` field (result/activities/error writes), a state no consumer of the channel recognises. Read the row's current `status` after the write and publish that instead; when no row matched the id nothing was written, so nothing is published either. Refs diegosouzapw#12392
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateCloudAgentTask(src/lib/cloudAgent/db.ts:124) publishedstate: "updated"onagent.task.updatedwhenever the update carried nostatusfield. Theactivitiessync insrc/app/api/v1/agents/tasks/[id]/route.ts:175and theresult/errorwrites hit that path, so theagentsWS channel carried a fabricated state that noOrchStatemaps to. This is the first bullet of the PR-B1 minors in feat: orchestration canvas polish (fase 2 PR-A final-review minors) #12392 ("read the row's realstatusor document"updated"as a sentinel").statusafter theUPDATEand publishes that; a status-carrying update still publishes the value it wrote, without the extra read. When no row matched the id nothing was written, so nothing is published either (the A2AupdateTaskalready behaves this way for an unknown id).emitAgentTaskUpdatedhelper (third bullet, it needsa2a/taskManager.tsand lands better after PR-B2), the no-opstatuswrite in the GET sync (fourth bullet), and thehubProxymodule-level state (second bullet).Related Issues
agentsWS channel that introduced the writer)Validation
tests/unit/agents-channel-publish.test.ts10/10 (node --test),node scripts/check/check-complexity-ratchets.mjs --base-ref origin/release/v3.8.51OK (0 violations in touched files),npm run check:changelog-integrityOK,npm run typecheck:core0 errorsnpm run lintrelease/v3.8.51; focused checks rerun afterwardeslint over the two touched files exits 0. Mutation: restoring the
?? "updated"fallback fails the "emits the row's current status" case; dropping theif (state)guard fails the "unknown id does not emit" case.Tests Added Or Updated
tests/unit/agents-channel-publish.test.ts: the "without a status field emits state 'updated'" case is replaced by "without a status field emits the row's current status" (queued → running, then aresult-only update publishesrunning), and a new "on an unknown id does not emit" case. Red on the base (2 fail / 8 pass), green with the change (10/10). The other eight cases are unchanged.Coverage Notes
src/lib/cloudAgent/db.ts: the new read-back branch and the no-row guard inupdateCloudAgentTaskare both exercised by the two cases above; the status-carrying branch stays covered by the existing "emits agent.task.updated with the new status" case.Reviewer Notes
SELECT ... WHERE id = ?per status-less update (theactivitiessync on drawer open,result/errorwrites). It runs on the primary key of a table that is already read on the same request path.agentschannel: after aresult-only write they now receive the task's real status (for examplerunning) instead of"updated"; nothing insrc/matched on the old sentinel.