Repository navigation
fix(witan): order graph commit ids by parsing them, not as text - #463
Merged
Merged
Conversation
task_claim trusts its verification read only once the read's commit has caught up with the claim's own write, and it decided that with a string comparison because 0.11's commit ids are ULIDs. From omnigraph 0.12 an id is hb1.<block>.<slot>.<nonce> with a decimal slot, so hb1.X.9 sorts after hb1.X.10. From the tenth write in a block a stale read would be trusted, or a fresh one retried to the attempt cap. A read's envelope carries only the id (no graph_manifest_version), so this parses the two ids. Commits of one block order by integer slot. A bare ULID (the bootstrap commit, or one from before `omnigraph upgrade`) is older than any history-block id. Otherwise the commits' own ULIDs decide, which is what comparing 0.11's ids did. An id of neither shape counts as not caught up and is logged. The comparison runs after the claim is written, so raising there would report a failure for a claim the caller holds. Claude-Session: https://claude.ai/code/session_01Mfmuz4DTn557AV8V17o98A
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix addresses numeric slot ordering with regression coverage and no identified blocking issues.
0 open findings
What changed in this PR
Fixes task_claim verification for omnigraph 0.12+ commit IDs, supporting the planned 0.13 upgrade while retaining 0.11 compatibility.
Changes:
- Parses commit IDs to compare history-block slots numerically.
- Uses parsed ordering in verification, with bounded retries for unknown formats.
- Adds regression coverage and updates documentation.
| File | Description |
|---|---|
| packages/witan-core/witan_core/omnigraph.py | Corrects commit-ordering documentation. |
| mcp/servers/witan/witan/server.py | Integrates parsed ordering into claim verification. |
| mcp/servers/witan/witan/commit_ids.py | Adds commit parsing and comparison. |
| mcp/servers/witan/tests/test_tasks.py | Covers catch-up retries and unknown formats. |
| mcp/servers/witan/tests/test_commit_ids.py | Tests ordering rules and real commit sequences. |
| mcp/servers/witan/changelog.d/20261008_132356_blarghmatey_omnigraph_013_commit_id_order.md | Records the verification fix. |
| docs/glossary.md | Explains version-dependent commit formats. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
N/A (witan task tk-stop-comparing-graph-commit-ids-as-strings-0-12--03da2d, part of the omnigraph 0.13 upgrade, spec in #461 D7)
Description (What does it do?)
task_claimtrusts its post-write verification read only once the read'sgraph_commit_idhas caught up with the claim's own write. It decided that with<and>=on the two strings, which works on 0.11 because every id is a ULID.From omnigraph 0.12 only a graph's first commit (and anything written before
omnigraph upgrade) is a bare ULID. Every later id ishb1.<block>.<slot>.<nonce>with a decimal slot, sohb1.X.9.…sorts afterhb1.X.10.…. From the tenth write in a block the check would trust a stale read, or retry a fresh one to its attempt cap.This adds
witan/commit_ids.pywithcommit_reached(seen, floor)and uses it in both comparisons:hb1id;The spec suggested ordering by
graph_manifest_version. A mutate response carries it but a read's envelope carries onlygraph_commit_id(checked on the 0.13.0 CLI and in upstream'sReadOutput), so the id is all the verification read has.An id of neither shape counts as not caught up and logs
witan.task_claim.verify.unorderable_commit. The comparison runs after the claim is written, so raising there would report a failure for a claim the caller holds.The helper lives in witan-council because
task_claimis its only caller. Putting it in witan-core would need a core release and a floor bump in the same change.Safe on 0.11, so it can merge ahead of the pin.
How can this be tested?
just test-witan-councilon omnigraph 0.11.0: 1446 passed.tests/test_commit_ids.py, the claim-verification tests intests/test_tasks.py) also pass against the 0.13.0 binary, with fix(witan-core): write timestamps at millisecond precision #462's timestamp fix applied locally so that 0.13 accepts the writes: 21 passed. On 0.13.0test_real_commit_ids_order_the_way_the_writes_happenedseeshb1.<block>.1.…throughhb1.<block>.12.…, and sorting those as strings gives the wrong order.just docs-checkpasses.https://claude.ai/code/session_01Mfmuz4DTn557AV8V17o98A