Skip to content

refactor(loop): unify tool-call dedup signature (canonical_json) [dirge-ark9] - #368

Merged
yogthos merged 1 commit into
mainfrom
refactor/unify-tool-call-signature
Jun 3, 2026
Merged

refactor(loop): unify tool-call dedup signature (canonical_json) [dirge-ark9]#368
yogthos merged 1 commit into
mainfrom
refactor/unify-tool-call-signature

Conversation

@yogthos

@yogthos yogthos commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

The two tool-call dedup sites used different canonicalization:

  • scavenge dedup (run.rs) — a nested canonical_json that sorts object keys and normalizes numeric reprs (11.0);
  • storm repeat detector (storm.rs) — raw serde_json::to_string, which only sorts keys while serde_json's preserve_order feature stays off and does not normalize 1 vs 1.0.

So a 1-vs-1.0 duplicate could slip past storm but not scavenge. storm's own comment already flagged this (dirge-7bwx review-fix #6) and asked to "reuse run::canonical_json".

  • Promote canonical_json to a shared pub(crate) fn in message.rs — the JSON-serialization module both already depend on, which avoids a stormrun circular dependency.
  • Route both dedup sites through it; delete the nested copy.
  • Add a test locking key-order + number stability.

Small behavior change (the point of the issue): storm now also dedups calls that differ only by integer-vs-float encoding, and is no longer silently dependent on the preserve_order feature. All 16 storm tests still pass; 2469 default + 2563 all-features; clean under -D warnings.

Closes dirge-ark9 (and dirge-7bwx review-fix #6).

…rge-ark9]

The scavenge dedup (run.rs) used a nested canonical_json that sorts keys
and normalizes numeric reprs (1 ≡ 1.0), while the storm repeat detector
used raw serde_json::to_string — which only sorts keys while serde_json's
preserve_order feature stays off and does NOT normalize 1 vs 1.0. So a
'1' vs '1.0' duplicate could slip past storm but not scavenge. storm's
own comment already flagged this and asked to 'reuse run::canonical_json'.

Promote canonical_json to a shared pub(crate) fn in message.rs (the
JSON-serialization module both already depend on — avoids a storm↔run
circular dep) and route both sites through it. Closes the long-standing
dirge-7bwx review-fix #6. Small behavior change: storm now also dedups
calls that differ only by integer-vs-float encoding. Adds a test locking
key-order + number stability; all 16 storm tests still pass; clean under
-D warnings (default + all-features).
@yogthos
yogthos merged commit fed198c into main Jun 3, 2026
10 checks passed
@yogthos
yogthos deleted the refactor/unify-tool-call-signature branch June 3, 2026 20:50
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.

1 participant