fix: get_step returns wrong step + pagination ceiling off-by-one#131
Open
vystartasv wants to merge 1 commit intoagi-inc:mainfrom
Open
fix: get_step returns wrong step + pagination ceiling off-by-one#131vystartasv wants to merge 1 commit intoagi-inc:mainfrom
vystartasv wants to merge 1 commit intoagi-inc:mainfrom
Conversation
get_step(task_id, step_id) was filtering by s.task_id instead of s.step_id, always returning the first step of the task regardless of the requested step_id. Pagination total_pages used floor division (len//page_size) which undercounts when items don't divide evenly. Changed to ceiling division: (len+page_size-1)//page_size. Affects both list_agent_tasks and list_agent_task_steps.
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.
Bugs Fixed
1.
get_step()returns wrong step (critical)InMemoryTaskDB.get_step(task_id, step_id)filters bys.task_idinstead ofs.step_id:Since all steps in
task.stepsshare the sametask_id, the filter matches EVERY step.next()returns the first one — regardless of whichstep_idwas requested. This meansGET /ap/v1/agent/tasks/{task_id}/steps/{step_id}always returns the wrong step.2. Pagination off-by-one (2 locations)
total_pagesuses floor division, undercounting when items don't divide evenly:Fixed in both
list_agent_tasksandlist_agent_task_steps.Impact
total_pages=1for 11 items at page_size=10 miss the second page entirely.