Skip to content

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

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
yunaremaia:fix/non-string-timestamp-crash
Sep 8, 2026
Merged

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

Conversation

@yunaremaia

Copy link
Copy Markdown
Contributor

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.

@yunaremaia

Copy link
Copy Markdown
Contributor Author

Hi @AgentPostmortem — gentle bump on this PR (fix: guard _ts against non-string timestamp values). Mergeable and CI green. Thanks!

@royalpinto007
royalpinto007 merged commit 5b6d0c2 into AgentPostmortem:main Sep 8, 2026
8 checks passed
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Nice work @yunaremaia, this is merged.

Contributions like this are what keep Agentrace moving.

A star on the repo would mean a lot if this project is useful to you.

Happy to see more from you whenever you have the time.

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

2 participants