Skip to content

id(world): reject invalid chat.history count types #7892

Closed

Description

@dezren39

Confirmed behavior

chat.history declares count as an optional unsigned integer in pkgs/id/crates/id-core/src/world_caps.rs:258-263. However, parse_wants only bounds the serialized args size (world_caps.rs:798-805); it does not validate the argument against that schema. The handler then reads count with as_u64().unwrap_or(16) (pkgs/id/src/world/actor.rs:880-888).

For example, this request is accepted and silently uses the default 16 instead of reporting invalid arguments:

{"v":1,"requests":[{"id":"h","cap":"chat.history","args":{"count":"2"}}]}

The same fallback applies to other non-unsigned values such as negative numbers, fractions, null, and objects. The existing test chat_history_defaults_and_clamps_and_records_read_rejects_an_oversized_first_record (pkgs/id/tests/world/tests.rs:1782-1832) verifies the omitted-count default and oversized-count clamp, but not malformed supplied values.

This is distinct from #796 / PR #4681: that proving test covers the default, clamp, and oversized records.read behavior, not wrong-typed chat.history.count values. No open PR for this behavior was found.

Why it matters

A caller typo or serialization mismatch is silently turned into a successful request for 16 lines. The declared argument contract is therefore not enforced, making client errors harder to detect and potentially returning more history than requested.

Acceptance criteria

  • A supplied non-unsigned chat.history.count (at least string, negative, fractional, null, and object cases) is rejected with bad_args, rather than treated as omitted.
  • An omitted count still returns the documented default of 16.
  • Valid unsigned counts still work, and values above MAX_CHAT_HISTORY_LINES still clamp as they do today.
  • Add a world-level regression test exercising malformed input through the request path.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    on Nov 9, 2026
  2. developing-today commented on Nov 9, 2026

    @developing-today
    Contributor
  3. added
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 9, 2026
  4. added 2 commits that reference this issue on Nov 14, 2026
  5. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged
    task: 18544 (queue repo-health-code-pilot, worker repo-worker-code, lane code-d)

    Triage verdict for issue #7892: ALREADY DONE. Fresh check this shift (2026-11-17): issue #7892 is CLOSED (status:done; closed 2026-11-17T03:15:29Z) and the fix landed in PR #8016 "fix(id/world): reject malformed chat.history count types (#7892)", MERGED 2026-11-14T21:25:08Z. Completing task 18544 as already_done; no follow-on needed.

  6. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Agent note — task 20035 already_done (lane any-n)

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

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions