Skip to content

fix(parse): guard _ts against non-string timestamp values - #32

Open
yunaremaia wants to merge 1 commit into
AgentPostmortem:mainfrom
yunaremaia:fix/non-string-timestamp-crash
Open

fix(parse): guard _ts against non-string timestamp values#32
yunaremaia wants to merge 1 commit into
AgentPostmortem:mainfrom
yunaremaia:fix/non-string-timestamp-crash

Conversation

@yunaremaia

Copy link
Copy Markdown

Summary

What — Guards _ts() in agentrace/parse.py against non-string timestamp values (e.g., numeric 1718000000 instead of ISO 8601 strings).

Why — A malformed transcript with a numeric timestamp field crashed _ts with AttributeError when calling .replace() on a non-string value. The existing guard only checked falsy values, not type.

How — Added isinstance(value, str) check before string operations. Non-string values now return None gracefully, consistent with how missing/invalid timestamps are handled elsewhere.

Test

  • Added test_non_string_timestamp_does_not_crash that writes a synthetic transcript with numeric timestamps (1718000000, 1718000600) and asserts the run parses with started_at and ended_at set to None.
  • All 20 tests pass.

Closes #20

A numeric timestamp (e.g. 1718000000 instead of ISO 8601 string) in a
malformed transcript crashed _ts with AttributeError when calling
value.replace(). Guard with isinstance check so non-string values
return None instead.

Closes AgentPostmortem#20
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Welcome, @yunaremaia, and thanks for your first pull request to Agentrace.

A quick look at CONTRIBUTING.md covers how things are set up and run here.

I'll review this shortly. Ask anything in the thread if something is unclear.

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.

Non-string timestamp crashes parsing with AttributeError

1 participant