Repository navigation
take an unfinished task as left open after 20 idle minutes, not abandoned after a day - #156
Merged
Merged
Conversation
…thout activity, not abandoned after a day
Renumber the lastActiveAt migration to v037, after main's v034-v036, and carry the rename and the 20-minute window into the built-in agent's tasks.
A call, a sub-task started under it or finish_task for a task left open takes it and every task above it up again, unless one of them was finished, rather than refusing it and asking for a new task. So an agent coming back after a pause carries on with the same task, and a built-in sub-agent that slept keeps its task instead of getting a new one.
… taking it up, and end a task left open at its last activity The migration adds lastActiveAt beside lastStartedAt rather than renaming it, so instances still on the version before keep working while a deploy replaces them; a later migration drops it. Opening a task on the agent pages only reads it. A sub-agent whose task was finished while it was at work gets a new one, as it has no start_task of its own. A task left open is drawn as ending at its lastActiveAt, which the timeline reads it by too, so its bar and status agree. The once-a-minute write lives in touchAgentTask, and starting a sub-task takes its parent up once.
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.
A task the agent never marks finished is now taken as "left open" once 20 minutes pass with nothing done for it or its sub-tasks, instead of "abandoned" a day after its last sub-task started. Agents often just don't mark tasks finished, so "abandoned" / "given up" misdescribed what happened, and a day kept forgotten tasks under way far too long.
Left open isn't final: the next call made for the task, a sub-task started under it, or
finish_tasktakes it, and every task above it, up again, so an agent coming back after a pause carries on with the same task. Only a task that is finished, or one left open under a task that was finished without it, is refused. The built-in agent's sub-agents rely on this too: one that slept long keeps its task rather than getting a new one, soensureThreadTask/setThreadTaskare gone, and its report finishes the task even where it was left open.Because a 20-minute clock counted from the start would cut off agents still at work, every call made for a task now resets the clock for it and every task above it (
touchAgentTask, sharing the top-down lockingcreateAgentTaskalready used). It's written at most once a minute per task, so a call isn't a write each. Migrationv037renamesAgentTask.lastStartedAttolastActiveAtand fills it from the audit log, so each task's is no earlier than the last request made for it or its sub-tasks. The status isleftOpen/ "Left open" across the web app and the docs.Open workspace in Conductor