Repository navigation
AI-3753: a user who left a team loses its tasks and live chats - #2411
martinmitrevski merged 12 commits into
Conversation
thesyncim
left a comment
There was a problem hiding this comment.
Reviewed at 7606c8e merged with main 0e5197a. The gate holds on every path the description claims, eight suites pass with -race, and it composes with #2384, #2371 and #2404. What stops it is a failing check and two cases where a user who is still entitled is turned away; those are inline.
Nits
scheduled_delivery.go:206: a task on a deleted config also endsnot_in_team. Give it its own reason, or say so in the doc.scheduling/scheduler.go:137:ReasonNotInTeamsays "a task its end user made"; it also covers the agent's tasks in a chat the backend opened. The API doc is loose in the same way.- After five
not_in_team(or unreadable) occurrences the task isfailed, and rejoining does not restart it. One line in the skill would help.
Question: in a chat the backend opened on a team's config, for a user Chat does not know or who has no teams, the chat works but every reminder the agent makes ends not_in_team. Should schedule_task be withheld there?
| StartedAt *time.Time `json:"started_at"` | ||
| FinishedAt *time.Time `json:"finished_at"` | ||
| Error *string `json:"error" doc:"Why it failed, as a short code, when it did: delivery_failed, timed_out, schedule_unreadable, user_on_call, channel_unreachable, no_reply, reply_failed, no_phone_number, no_agent_number, not_answered, already_called (a call was placed for the occurrence on an earlier attempt, so the user is not rung again; that call may have carried the task out, so the run does not count toward the five failures in a row), outside_window (a WhatsApp thread task whose person last wrote over 24 hours ago, with no template to send), thread_gone (a thread task's thread no longer exists or is not its user's), connection_removed (a thread task's line was removed), tier_limit_reached (the organization's tier limits refuse the call or the text: tried again for a limit of the day or of calls at once, not for a country), or, refused for money, account_suspended, insufficient_credits, system_limit_reached, spend_limit_reached or user_limit_reached, none of which is tried again, or spend_check_unavailable (the router could not check what the organization has spent, so the run is tried again); on a missed run, task_paused (a run's time came while its task was paused). The full error is in the router's logs. Null otherwise."` | ||
| Error *string `json:"error" doc:"Why it failed, as a short code, when it did: delivery_failed, timed_out, schedule_unreadable, user_on_call, channel_unreachable, no_reply, reply_failed, no_phone_number, no_agent_number, not_answered, already_called (a call was placed for the occurrence on an earlier attempt, so the user is not rung again; that call may have carried the task out, so the run does not count toward the five failures in a row), outside_window (a WhatsApp thread task whose person last wrote over 24 hours ago, with no template to send), thread_gone (a thread task's thread no longer exists or is not its user's), connection_removed (a thread task's line was removed), tier_limit_reached (the organization's tier limits refuse the call or the text: tried again for a limit of the day or of calls at once, not for a country), not_in_team (in an app that keeps each team's agents to its own users, the user who made the task is no longer in its agent's team, so the agent is not run; not tried again), or, refused for money, account_suspended, insufficient_credits, system_limit_reached, spend_limit_reached or user_limit_reached, none of which is tried again, or spend_check_unavailable (the router could not check what the organization has spent, so the run is tried again); on a missed run, task_paused (a run's time came while its task was paused). The full error is in the router's logs. Null otherwise."` |
There was a problem hiding this comment.
Must fix: the kotlin check fails on this doc string: ScheduledTaskRun.kt was not regenerated. The failing step prints the diff to commit.
There was a problem hiding this comment.
Fixed in a522e94: ScheduledTaskRun.kt now carries the diff the check printed, the same not_in_team text as openapi.yaml.
| s.holdProxyFor(ctx, state, request, found, owner) | ||
| }() | ||
| return | ||
| } |
There was a problem hiding this comment.
Should fix: when the holder cannot read the teams (an error, or an answer slower than attachWait), the asker hears nothing and goes on to sessionToAnswer. For a user still in the team whose teams the asking node holds, or where its own later read succeeds, that tries to open the running chat a second time: 500 after 5 s in a two-node test, 101 without the check. Could the holder answer that it could not check, so the asker returns 503 without reopening?
There was a problem hiding this comment.
Fixed in 36526cc. The node running the chat now answers an attach it could not check with relay.Unavailable, and the asking node answers 503 errTeamsUnreadable without carrying the chat on. Out of the team still sends nothing, so it stays a 404. The check is bounded by teamCheckWait (1.5 s), short of the asker's 2 s, so a slow read is answered too. Your two-node case is TestAWatcherFromAnotherNode…IsToldToTryAgain, as a failed read and as a slow one; both gave 500 before.
| } | ||
| if err == nil { | ||
| key := heldTeamsKey(customerID, bound.Client, caller.UserID) | ||
| if teams, held := s.teams.of(key); held { |
There was a problem hiding this comment.
Should fix: the held teams also refuse: a user added to a team right after a 404 keeps getting 404 for up to 30 s, and a one-shot due in that window fails for good. Main reads the teams each time. Could a refusal from held teams ask Stream once more, bounded, before it stands?
There was a problem hiding this comment.
Fixed in 543459d and deb129e. A refusal from held teams now asks Stream again before it stands (teamsGate.refuses → heldTeams.again), at most once per user per second, failed asks included, with refusals meanwhile waiting for that one read. A user added right after a 404 gets in on the next ask. If Stream cannot be asked, the held refusal stands (a 404, not a 503), so a one-shot can still end not_in_team only within a second of the last ask or during an outage. Tests in teams_test.go, including read counts for a user who keeps asking.
| // a watcher relayed from another node, or an occurrence of their scheduled task. Their backend | ||
| // is not checked, as it is not on a request. | ||
| func (s *Server) refuseOwnerOutsideTeam(ctx context.Context, owner session.Owner, configID string) error { | ||
| if configID == "" || s.store == nil || owner.Kind == auth.KindServer { |
There was a problem hiding this comment.
Should fix (tests): two parts of this function have no test: an owner of kind guest, and a task on no config (dropping either condition keeps the suites green). Rows: a signed guest in team red watches from another node, expect 101; an agent task on no config, user in team red, fires and is delivered with Stream not asked.
There was a problem hiding this comment.
Added both rows in 68e560e. A signed guest in team red watching from another node gets 101, and fails once Verified is narrowed to authenticated users. An agent task on no config is delivered without a /users read, and fails with the configID == "" clause dropped.
|
Thanks. All four inline points are fixed (replied there). On the rest: Nits: agreed on all three, and listed under follow-ups in the description rather than done here. The deleted-config reason and the
|
In an app with agent_teams on, a member removed from a team kept the team's agent through three paths nothing checked: - Scheduled tasks: the device endpoints never looked at the task's config, and a fire ran the agent as the server. loadScheduledTask now answers a task on a config outside the caller's teams as one that does not exist; the list leaves those out in its query, before the page is cut. DeliverScheduledTask checks an end user's task once, before the live, peer, reopen and open paths: out of the team fails the occurrence not_in_team, final; teams Stream could not read fail the attempt. - A chat still running: carryOn checks every session it finds here, not only one that ended. - The events socket: watchSession finds a session through carryOn, and attachProxy checks the relayed owner off the bus's subscription. A backend is never checked and asks Stream nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fixes on the team checks: - A task the agent made in a chat with its user (created_by agent, off a thread) is fire-checked as one the user made, whatever kind opened the chat: a reminder made in a chat their backend opened kept firing after they left the team. A task the backend made through the API, or the agent on a thread, stays unchecked. - A device pauses and deletes a task of its own without the teams check: stopping one runs nothing of the agent, and a removed user could not stop a task still firing for them. - A relayed attach is recorded as pending on the bus subscription before its off-bus team check; a Detach removes it and holdProxy attaches only a still-pending watcher, so a socket that gave up during the check leaves no watcher held until pongWait. - callerTeams holds what Stream answered for 30 s on the Server, keyed by customer, Stream app and user, at most 100,000 users; a failed read is not held. A removal is seen within 30 s. - A tool approval on the caller's own session is team-checked, as carryOn is; a chat_channels session the Router opened is not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pins the approval check failing closed: with Stream unable to tell the user's teams, an answer to a held call is a 503 and the call goes on waiting. The refused-attach test waits for its watcher to leave the pending set rather than for every check in the process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…again The node running a chat answers an attach it could not check with an unavailable answer, within a shorter budget than the asker waits, so the asking node answers 503 rather than carrying the running chat on a second time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refusal made from the teams a router holds asks Stream once more before it stands, so a user added to a team right after a 404 is let in on the next ask rather than up to 30 s later. A key asks again at most once per second, failed asks included, and refusals made meanwhile wait for that one read. While Stream cannot be asked, the held refusal stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A signed guest in the config's team watches a chat running on another node, and an agent task on no config is delivered without asking Stream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a second Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stand-on-failure test asks for a config of no team, which no teams would open, and a gate whose held teams are gone keeps its refusal. The bound tests stop the held teams' clock so a slow run asks within one teamsRecheck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not be asked Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82d90ce to
8b6d7c5
Compare
|
Rebased onto main: the only conflict was the Swift client's fingerprint, regenerated with the generator at the commit it records (8b6d7c5); |
Why
In an app with
agent_teamson, an end user reaches an agent config only while they share a team with it. That was checked when a session opened and when an ended one was carried on, but not on the paths that keep a removed member talking to the team's agent:list,get,update,pause,resume,delete,runs) looked at the task's config. A fire ran the agent as the server (scheduledOwnerContextsets server-side, soteamsGateForlet it through), andopenTaskSessionand the live and peer paths checked nothing. A recurring task kept sending the team agent's output, with its fixed connectors, to a user removed from the team, and the user could still reschedule, resume or re-aim it.carryOnchecked the team only for a chat that ended here or was reopened from its row. A message, resume, rewind or voice start to a running chat was not checked.watchSessionon a running chat, andattachProxyfor a socket on another node, checked nothing.POST /v1/agents/conversations/{cid}/tool_approvalsreleased a held connector call of the user's own session with no team check, so a removed member could let the restricted agent's connector call go.How it works
teamsGateForreads the caller from the request;userTeamsGateandrefuseOwnerOutsideTeamtake the user outright, for the places with no request of theirs: a relayed watcher and a task's fire. Aserverowner is never checked and Stream is not asked.errUnknownConfig(404) anderrTeamsUnreadable(503), asreopenedFromRowdoes. A task out of the caller's team is answered as one that does not exist (errUnknownScheduledTask, 404), byte for byte, since the list leaves it out. An approval out of the team is answered as one nobody waits for (errNoApprovalHeld, 404), as a non-member's is.ScheduledTasks.Configsreads the live configs of the caller's tasks, the gate's ownrefusespicks the reachable ones, andSelectkeeps tasks on those or on no config beforeLIMIT + 1. Pages come back full and the cursor is right.session/schedule_tools.go), so a reminder a user asked for in a chat their backend opened iscaller_kind: server. A fire checks the task's user when they made it (caller_kindnotserver) or the agent did (created_by: agent) outside a thread. A task the backend made through the API stays the backend's. A task the agent made on an SMS, WhatsApp or iMessage thread is answered by the Router's own thread session, which no team limits (threadSession), and its person is a bridge user with no teams, so checking it would fail every thread reminder on a team config.DeliverScheduledTask, before the split into thread, live, peer, reopen and open; the peer it is handed to takes the asker's word. Out of team isundeliveredFinally(not_in_team), asthread_goneis.teamCheckWait(1.5 s), short of the asker'sattachWait(2 s). A check that could not be made (Stream failed or was too slow) is answeredrelay.Unavailable, and the asking node answers 503errTeamsUnreadablewithout opening the chat a second time; out of the team still sends nothing, a 404. Each attach is recorded as pending on the subscription before the check starts; aDetachremoves it, andholdProxyattaches only a still-pending watcher, under the same lock. A socket that gives up during the check (itsattachWaitran out or its client dropped) leaves no watcher held.callerTeamskeeps what Stream answered for 30 s (teamsFor) inheldTeamson theServer, keyed by customer, Stream app and user, at most 100,000 users (emptied when full, asconversation's known users are). A failed read is not kept. Held teams that refuse ask Stream again before the refusal stands (heldTeams.again): at most once per user per second (teamsRecheck), failed asks included, with refusals meanwhile waiting for that one read; if the ask fails, the held refusal stands. So a user added to a team is let in on the next ask, not 30 s later. The lookup is after the verified-caller and own-app checks, so a caller with no token never reads it.scheduled_task_not_foundfailednot_in_team, no sessionagent_config_not_foundfailednot_in_team(it speaks in the user's conversation)Decisions for review:
UserTeams' comment said no copy is kept; it now says the router holds one briefly.TestAUserOpensAConfigOfTheirTeamAskingStreamEachTimepinned the old rule and is replaced by the lifetime test; tests that move a user between teams now let the held teams lapse first (teamsLapse), as 30 s would.by.Reaches(OwnerOf(spec)), the sessionscarryOnchecks). Achat_channelssession the Router opened answers its writers by membership, whatever their teams, so their approval is not team-checked either (TestAWriterAnswersACallInAChannelTypeWhateverTheirTeamspins it).Known limits:
tool_approvalframes sent over a socket that was open when the member was removed still reach the agent until it closes.addSessionTools,removeSessionTool,stopSessionandstopSessionVoiceuses.sessiondirectly and are not team-checked. They make the agent say nothing new.Validation
AgentTeamsSuite/TestAMessageToAChatStillRunningIsRefusedToAUserWhoLeftItsConfigsTeam,…/TestAResumeOfAChatStillRunningIsRefusedToAUserWhoLeftItsConfigsTeamAgentTeamsSuite/TestAChatStillRunningIsWatchedOnlyByAUserStillInItsConfigsTeamAgentTeamsSuite/TestAChatRunningOnAnotherNodeIsWatchedOnlyByAUserStillInItsConfigsTeamattachProxyattaches a removed member's relayed watcherAgentTeamsSuite/TestASocketThatGivesUpDuringItsTeamCheckLeavesNoWatcherHeldDetachthat overtakes the off-bus check leaves a watcher held untilpongWaitAgentTeamsSuite/TestARefusedRelayedAttachLeavesNothingPendingunexpectRelayedSessionSuite/TestAnAttachThatCannotBeAnsweredLeavesNothingPendingWatchFromrefusesunexpectAgentTeamsSuite/TestASlowTeamsReadHoldsUpNoOtherSocketOnTheNodeAgentTeamsSuite/TestAUsersTeamsAreAskedOfStreamOnceForAsLongAsTheyAreHeldAgentTeamsSuite/TestTheTeamsHeldForAUserAreNotLentToTheSameIdInAnotherAppAgentTeamsSuite/TestARouterHoldsTheTeamsOfAtMostMaxHeldTeamsUsersAgentTeamsSuite/TestACallerWithNoTokenDoesNotBorrowTheTeamsHeldForTheUserItClaimsToBeAgentTeamsSuite/TestABackendWatchesAChatOfAnyTeamRunningOnAnotherNodeWithoutAskingStreamAgentTeamsSuite/TestACallerWithNoTokenWatchingFromAnotherNodeIsInNoTeamWhoeverItClaimsToBeScheduledTasksSuite/TestATaskOfATeamTheUserLeftIsAnsweredAsATaskThatDoesNotExistScheduledTasksSuite/TestAUserWhoLeftATasksTeamStillPausesAndDeletesItScheduledTasksSuite/TestAUserStillInATasksTeamReachesItByEveryOperationScheduledTasksSuite/TestABackendReachesATaskOfATeamItsUserLeftWithoutAskingStreamScheduledTasksSuite/TestTheListLeavesOutTasksOfAnotherTeamAndStillFillsEachPageScheduledTasksSuite/TestATaskOfATeamIsReachedByNoUserWhileTheirTeamsCannotBeReadScheduledTasksSuite/TestATaskOfAUserWhoLeftItsAgentsTeamFailsWithoutRunningTheAgentScheduledTasksSuite/TestATaskOfAUserWhoLeftItsAgentsTeamIsNotFollowedUpInTheirRunningChatScheduledTasksSuite/TestATaskOfAUserWhoLeftItsAgentsTeamIsNotHandedToTheNodeHoldingTheirChatScheduledTasksSuite/TestATaskTheAgentMadeInAChatTheBackendOpenedFailsOnceItsUserLeftTheTeamservertask keeps firing for a removed memberScheduledTasksSuite/TestATaskTheAgentMadeOnAThreadIsNotCheckedAgainstItsPersonsTeamsScheduledTasksSuite/TestATaskOfAUserStillInItsAgentsTeamIsDeliveredScheduledTasksSuite/TestATaskItsBackendMadeForAUserOutsideTheTeamIsDeliveredScheduledTasksSuite/TestAnOccurrenceWhoseTeamsCannotBeReadFailsAndTheTaskGoesOnSessionConnectorsSuite/TestAUserWhoLeftTheConfigsTeamCannotAllowItsHeldCallSessionConnectorsSuite/TestAnAnswerWhileTheUsersTeamsCannotBeReadIsRefusedSessionConnectorsSuite/TestAUserInTheConfigsTeamAllowsItsHeldCallThroughTheConversationAppHooksSuite/TestAWriterAnswersACallInAChannelTypeWhateverTheirTeamschat_channelswriter's approval is team-checkedFails before the fix: shown with
go test -overlay, one mutated file each, that puts the rule back as it was. The rows marked yes failed under them; the branch's first commit is the "before" for findings 1 to 4 of the review.Mutants, each caught by the tests named (all run with
-race):created_byignored) →TestATaskTheAgentMadeInAChatTheBackendOpenedFailsOnceItsUserLeftTheTeam; the thread exclusion dropped →TestATaskTheAgentMadeOnAThreadIsNotCheckedAgainstItsPersonsTeams; everyservertask checked (created_bytest made true) →TestATaskItsBackendMadeForAUserOutsideTheTeamIsDelivered; the check moved after the thread and peer split (live-here and reopen only) →TestATaskOfAUserWhoLeftItsAgentsTeamIsNotHandedToTheNodeHoldingTheirChat.TestAUserWhoLeftATasksTeamStillPausesAndDeletesIt;loadScheduledTaskwith no team check → the refusal and unreadable tests;ownScheduledTaskwith no owner check →TestTheOwnerReachesATaskItsBackendMadeAndAnotherUserDoesNot.holdProxyignoring pending, ordropProxyleaving it →TestASocketThatGivesUpDuringItsTeamCheckLeavesNoWatcherHeld; the check inline on the subscription with no timeout (the review's surviving mutant) →TestASlowTeamsReadHoldsUpNoOtherSocketOnTheNodeand the give-up test; the goroutine'sunexpectdropped →TestARefusedRelayedAttachLeavesNothingPending; the inline path's dropped →TestAnAttachThatCannotBeAnsweredLeavesNothingPending; noexpect→ every relayed attach, e.g.TestRelayedSessionSuite/TestASessionIsWatchedFromANodeThatIsNotRunningIt.TestTheTeamsHeldForAUserAreNotLentToTheSameIdInAnotherApp; keyed without the user → the tests with two users of one app (five, run before the split); read before the verified-caller check →TestACallerWithNoTokenDoesNotBorrowTheTeamsHeldForTheUserItClaimsToBe; no bound →TestARouterHoldsTheTeamsOfAtMostMaxHeldTeamsUsers.TestAUserWhoLeftTheConfigsTeamCannotAllowItsHeldCall; checked on every session (the owner gate made true) →TestAWriterAnswersACallInAChannelTypeWhateverTheirTeams; the refusal answered aserrUnknownConfig→ the removal test; refusing onlyerrUnknownConfigand letting an unreadable read through →TestAnAnswerWhileTheUsersTeamsCannotBeReadIsRefused.TestATaskOfAUserWhoLeftItsAgentsTeamFailsWithoutRunningTheAgent; unreadable made final →TestAnOccurrenceWhoseTeamsCannotBeReadFailsAndTheTaskGoesOn;attachProxywith no check →TestAChatRunningOnAnotherNodeIsWatchedOnlyByAUserStillInItsConfigsTeam;Verifiedforced true for a relayed owner →TestACallerWithNoTokenWatchingFromAnotherNodeIsInNoTeamWhoeverItClaimsToBe;loadScheduledTaskansweringerrUnknownConfigunmapped → the refusal test;carryOnwith no check → both running-chat tests and the running-chat watch test;refuseOwnerOutsideTeamchecking aserverowner →TestATaskItsBackendMadeForAUserOutsideTheTeamIsDelivered; the list unnarrowed → the list test. Not run again:carryOn's old placement,watchSessionwithoutcarryOn,refusesinverted, theconfig_id = ''branch dropped, deleted configs kept.After review (
-race, in full):AgentTeamsSuite,RelayedSessionSuite,ScheduledTasksSuite,SessionConnectorsSuite,AppHooksSuite,ChannelTypeTurnSuite,ChildAgentsSuite,SessionEventsSuite,SocketSessionSuite,CrossShardSessionSuite,ForwardedSessionSuite,ConfigsSuite. New tests, each failing with its mutant:TestAWatcherFromAnotherNodeWhoseTeamsCannotBeReadIsToldToTryAgainand…AreReadTooSlowlyIsToldToTryAgain(the pre-fix relay gives 500; no answer sent, the answer handled after the filter, orteamCheckWait = attachWait);TestAUserAddedToATeamRightAfterARefusalIsLetInOnTheNextAsk,TestAUserRefusedOverAndOverAsksStreamOnceEachTeamsRecheck,TestARefusalOfHeldTeamsStandsWhileStreamCannotBeAskedAgain,TestARefusalWhoseHeldTeamsAreGoneStands,TestRefusalsWhileStreamIsAskedAgainWaitForItsOneAnswer(no re-ask, no bound, failed asks not counted, waiters not waiting, no sharing);TestASignedGuestInTheTeamWatchesAChatRunningOnAnotherNode(Verifiednarrowed to authenticated) andTestATaskTheAgentMadeInAChatOnNoConfigIsDeliveredWithoutAskingStream(theconfigID == ""clause dropped). The two deployment-app read counts are now 4: each user's one refusal asks once more.The give-up test's limits: it waits for the check to end by counting
attachProxycheck goroutines in the whole test process, so a check of another suite running at the same time only delays it; and it would pass without proving anything if the held Stream read outlastedteamCheckWait(1.5 s) before the release, as the check would then time out. Its steps take well under that locally (0.3 s).Mutant not caught: forcing a backend's relayed attach through the goroutine too (
owner.Kind != servermadetrue).refuseOwnerOutsideTeampasses aserverowner, so it changes only which goroutine attaches.Passed locally, in full, with
-race, after the rebase ontomain(AgentTeamsSuite,SessionConnectorsSuiteandRelayedSessionSuiteagain after the last tests were added):AgentTeamsSuite,ScheduledTasksSuite,RelayedSessionSuite,SessionEventsSuite,SocketSessionSuite,SessionOwnershipSuite,SessionResumeSuite,SessionCommandsSuite,CrossShardSessionSuite,ForwardedSessionSuite,SessionConnectorsSuite,AppHooksSuiteandChannelTypeTurnSuite(one run, 267 s). Also the store's scheduled-task tests (TestStoreSuite/.*Task.*, 43 tests),go vet -tags integration ./...andgofmt. The first commit also ranIncognitoSuite,SocketCloseLogSuite,SessionToolsSuite,SessionReopenSettingsSuiteandResumeHistorySuite; they were not run again. The rest ofinternal/apiis left to CI.Generated: rebased onto
mainafter fix(api): a device can't set a new session's phone line, models, limits, greeting or tags #2366 and AI-3741: a scheduled task's turn cannot arm another #2392.sdks/swift/core/generated.jsonconflicted: main's side was taken and the Swift client regenerated with the generator at the commit it records (a73c9124), which changed only the fingerprint.openapi.yaml, the Go SDK and the Python plugin were regenerated and matched what the merge left;.agents/skills/pr-review/scripts/generated.shreports every generated file in step (openapi.yaml, JS). Rust:cargo run -p generate -- --checkpasses. .NETModels.cswas not checked after the rebase (no .NET SDK here, and its check runs in Docker); its diff againstmainis only theerrordoc string. Kotlin'sScheduledTaskRun.ktfailed thekotlincheck with the old doc string; it now carries the diff that check printed (24d7b0d), the samenot_in_teamtext asopenapi.yaml. Dart and PHP keep only its first words. Thenot_in_teamdoc string still says "the user who made the task", which is loose for a task the agent made in their chat; changing it means regenerating every client, .NET and Kotlin among them, which cannot run here, so it is left as is.The list query, for a checked end user only (neither table is in the hot-table explain suite); unchanged by the review fixes:
Plan before:
EXPLAIN (ANALYZE, BUFFERS), local Postgres 19, 101,000 tasks over 200 customers and 2,000 configs, the user listed holding 1,000 tasks on 10 configsPlans after: the configs read, then the list
scheduled_tasks_user_idxagent_configs_name_idxfor the configsinternal/scheduling/AGENTS.md(a rule near line 81, apart from this branch's hunks at 29 and 351) andScheduledTasks.Claiminstore/scheduled_task.go, away fromSelectandConfigs. AI-3685: per-customer session ids, AI-3563 step 3 of 3 #2327 and fix(session): opening a conversation ends only a session its caller reaches or shares it as a member #2371 touch none of this branch's files.TestASocketThatGivesUpDuringItsTeamCheckLeavesNoWatcherHeldfinds the running check by its function name in a goroutine dump, so a rename would let it pass without testing anything. A task on a deleted config also endsnot_in_team: it could have its own reason.ReasonNotInTeam's doc says "a task its end user made" but also covers the agent's tasks in a chat the backend opened, and the API doc is loose the same way; both change the spec and every client, so they go together. After fivenot_in_team(or unreadable) occurrences a task isfailed, and rejoining the team does not restart it: the scheduled-tasks skill should say so. In a chat the backend opened on a team's config for a user Chat does not know or who is in no team, every reminder the agent makes endsnot_in_team:schedule_taskcould check the user against the config's team when it stores the task. A relayed check that failed on the holder's settings or config read is answered 503 "teams could not be read", where the local path answers 500.Fixes AI-3753
🤖 Generated with Claude Code