fix(pixel-agent-teams): guard get result in list to tolerate unreadable history files - #5944
Open
vaibhavsrv wants to merge 1 commit into
Open
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
This was referenced Sep 19, 2026
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.
Why this matters
In
ods/extensions/services/dashboard-api/pixel_agent_teams.py,TeamStore.list(owner, chat)scans the agent history directory for files matching{owner}-*.jsonand processes each file withrow = self.get(owner, path.stem[65:]), followed immediately by accessingif row["chat_id"] == chat:. If a file in the directory is corrupted, partially written, permissions-restricted, or returnsNonefromself.get(), accessingrow["chat_id"]raises an unhandledTypeError: 'NoneType' object is not subscriptableorKeyError. This causes the entire agent team listing endpoint to crash for that user instead of gracefully skipping unreadable entries.This change wraps
self.get()in a local exception handler and guards the membership test withif isinstance(row, dict) and row.get("chat_id") == chat:. It also usesx.get("created", 0)during sorting so that missing creation timestamps do not abort result sorting. Valid team files continue to be listed and sorted by creation date as before.Validation
TeamStore.list()to fail withTypeError/ValueError.Overlap check
roles_forinpixel_agent_teams.py.routers/pixel.py.pixel_settings/contract.py.pixel_edge.py.This PR solely addresses persistence resilience in
TeamStore.listinpixel_agent_teams.pyand does not overlap with any concurrent work.Risk / AI disclosure
AI-assisted defect analysis, implementation, and regression test authoring. This strengthens error tolerance during state retrieval and does not alter persistence schemas, models, or network communications. Independent human review remains a gate.
Follow-up integration evidence
Composed cleanly on top of #5569, #5871, and #5875 at HEAD without conflicts. Production and test diffs passed together; adjacent pixel-agent and pixel-settings checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.