logs/traces: `--since 5` (missing unit) silently searches from 2001

Open Beginner friendly
#2,940 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bun, node.js, typescript
Domain
cli, observability

Research direction

Start with parseTimeString in src/handlers/observability/time.ts and check how bare numeric strings are handled before they reach Date.parse. Add rejection with the expected invalid-time guidance for unsupported bare numbers, then run the relevant logs and traces tests. Done means values such as 5, 60, and 45 produce the invalid-time error while supported formats still work.

Written by the indexing model from the issue text.

Description

Description

--since / --until on the logs and traces commands accept 5m, 1h, ISO 8601, epoch ms or
now. A bare number shorter than 13 digits is not rejected: parseTimeString
(src/handlers/observability/time.ts) passes it to Date.parse, which reads it leniently as a
calendar date. So a forgotten unit turns into a window decades long, or a confusing error.

Steps to Reproduce
  1. agentcore runtime logs --id <runtime-id> --since 5 (meant 5m).
  2. agentcore runtime logs --id <runtime-id> --since 60.
  3. agentcore runtime logs --id <runtime-id> --since 45.
Expected Behavior

Invalid time string: "5". Use relative durations (5m, 1h, 2d), ISO 8601, epoch ms, or "now".

Actual Behavior
  1. Searches from 2001-05-01 (Date.parse("5")).
  2. Searches from 1960-01-01.
  3. Fails with --since must resolve to a time before --until ("45" is 2045-01-01).

("30" happens to be rejected, because V8 cannot parse it.)

CLI Version

1.2.0 (current v1.x, a6452a4)

Operating System

Linux

Additional Context

Same under Node 22 and Bun 1.4 (the npm bundle and the compiled binaries).

Dominant language
TypeScript
Stars
339
Forks
129
Avg merge
19h 21m
Merged PRs (30d)
125

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/agentcore-cli

All issues in aws/agentcore-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.