Skip to content

parse_time silently ignores remaining compound duration components #376

Description

@Calmingstorm

Confirmed silent time-parsing error

Reviewed master at 886c36d8ebe861aa987059a1744d45b78797baae (v4.7.0). Suggested priority: P2.

parse_time's relative-duration branch uses an unanchored prefix match and immediately returns after the first amount/unit. It accepts a compound expression while silently ignoring the remaining duration.

Reproduction

parse_time("in 1 hour 30 minutes", now=datetime(2026, 1, 1, tzinfo=UTC))
Actual:   2026-01-01T01:00:00+00:00
Expected: 2026-01-01T01:30:00+00:00, or an explicit unsupported-expression error

Independently reproduced twice with the pinned source. The schedule tool directs callers to use parse_time for natural-language one-time scheduling, so this can silently schedule work 30 minutes early.

Acceptance criteria

  • Consume the complete supported expression, or reject unconsumed input.
  • Prefer parsing supported compound amount/unit pairs; rejection is still safer than a confidently wrong timestamp.
  • Test compound hours/minutes and days/hours, whitespace, malformed suffixes and existing single-unit inputs.

Behavior change: currently accepted but misinterpreted compound inputs get correct results or explicit errors. Broader natural-language syntax is not required by this bug. No source changes were made.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions