Skip to content

fix(microskills): skip non-dict JSON lines in load_calls - #199

Open
Tejas Lamba (TejasLamba2006) wants to merge 1 commit into
microsoft:mainfrom
TejasLamba2006:fix/load-calls-isinstance-check
Open

Tejas Lamba (TejasLamba2006) wants to merge 1 commit into
microsoft:mainfrom
TejasLamba2006:fix/load-calls-isinstance-check

Conversation

@TejasLamba2006

Copy link
Copy Markdown
Contributor

Summary

load_calls in distiller.py parses transcript JSONL files but doesn't guard against non-dict JSON lines. A line like null, [1,2], or "string" passes json.loads but fails on d.get("message") with AttributeError.

This is the same pattern fixed in #180 (cursor readers) and #182 (agent-output readers), applied to the transcript reader used by the proposer.

Changes

Added isinstance(d, dict) check after json.loads, before accessing dict methods.

Test plan

# Before fix: AttributeError: 'NoneType' object has no attribute 'get'
# After fix: returns [] and skips bad lines
load_calls("file_with_null_line.jsonl")

Separate from #198 which guards parse_payload (proposer reply) - this guards load_calls (transcript parsing).

Same pattern as microsoft#180/microsoft#182: json.loads can return null/list/string,
and d.get("message") fails with AttributeError on non-dicts.

This is a separate fix from microsoft#198 (parse_payload guards) - load_calls
parses the transcript, parse_payload parses the proposer reply.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant