Skip to content

feat(skills): add content-hash digest + change-detection to partial skill loads - #304

Merged
sumithr merged 2 commits into
mainfrom
feat/issue-290-progressive-skill-loading-pr6
Jun 2, 2026
Merged

sumithr merged 2 commits into
mainfrom
feat/issue-290-progressive-skill-loading-pr6

Conversation

@sumithr

@sumithr sumithr commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Closes #290 (PR6 of epic #137 — progressive skill loading).

What changed

Content-hash digest / change-detection for partial loads (builds on #285's content_hash/estimated_tokens). Each slice of sumo_qa_load_skill_context (full / section / module) now returns content_hash (sha256 of exactly the returned text) + estimated_tokens, plus an optional known_hash arg: match → changed=false + body omitted; mismatch → changed=true + body included; omitted → body always returned. Stateless (no session cache — documented why: MCP session identity is unreliable across supported hosts). No network / embeddings / vector calls.

Evidence

…kill loads

Lever 6 of the progressive-skill-loading epic (#137), building on PR1 (#285).

Each partial slice from sumo_qa_load_skill_context (section/module/full) now
returns content_hash (sha256 of exactly the returned text) and estimated_tokens.
A new optional known_hash arg lets a caller ask "has this slice changed since
hash X?": a match returns changed=false with the body omitted (the token
saving), a mismatch returns changed=true with the body.

Change-detection is derived per call - the loader re-hashes the live slice and
compares. No server-side session cache was added: MCP session identity is not
reliable across the supported hosts, so a cache keyed on an unstable identity
would leak across or silently miss sessions; re-hashing a small local slice is
safer and stays deterministic and stateless. No network, embeddings, vector
stores, or external model calls are introduced.

Regenerated the tools/list snapshot (one new optional known_hash property on
sumo_qa_load_skill_context). Updated docs/TOOLS.md and docs/ARCHITECTURE.md with
the per-slice digest fields, the change-detection affordance, and the
no-session-cache rationale.

Closes #290
@sumithr

sumithr commented Jun 2, 2026

Copy link
Copy Markdown
Owner Author

Merge-readiness evidence (finish-pr-batch)

Per-file sumo-qa review (sumo-qa-reviewing-before-merge, per changed file) — SAFE: full decision-table coverage of the (mode × known_hash × match) matrix; content_hash shown to be the sha256 of exactly the returned slice.

Codex adversarial pass: clean — content_hash is the sha256 of exactly the bytes returned as content for every mode; known_hash is never evaluated on an error path (so it can't raise or alter error behavior); manifest-mode hash agrees with full-mode; hashing is deterministic. Notable: this is the same skill_manifest.py that carried #285's P2, and the never-raises envelope contract is preserved with the new arg.

Behavioral verification (executed on a real skill, branch tip dd1513f):

  • load_skill_context(skill,"full") → returned content_hash; independent sha256 of the returned content matches ✓
  • same call with known_hash=<that hash> → changed=false, body omitted ✓
  • with known_hash="deadbeef" → changed=true, body included ✓
  • section mode → content_hash == sha256 of exactly that slice; section round-trip → changed=false ✓
  • missing arg / unknown skill with known_hash set → error envelope, no raise (the [Task]: Progressive skill loading PR1 — skill manifests + section/module index + partial skill-context loader #285-P2 same-file regression guard holds) ✓

Acceptance criteria (#290): all 4 met against the branch (partial loads return content_hash+estimated_tokens; deterministic "changed since X?"; no hidden cache — stateless per-call re-hash, documented; no network/embeddings/vector calls — module imports only hashlib/re/pathlib/typing).

CI: full matrix green. Tests: 1496 passed, 1 xfailed, 100% coverage.

@sumithr

sumithr commented Jun 2, 2026

Copy link
Copy Markdown
Owner Author

Integration / user-flow verification (wave-2 batch: #301 #302 #303 #304)

Per-PR CI is green only in isolation against main. All four touch src/sumo_qa/server.py (this PR adds known_hash + regenerates the tools snapshot — the same files #302 touches), so I verified the combined state before merge — stack-merged all four onto a throwaway branch off main and exercised the integrated flow:

Merge stack: this PR merges last and hits one conflict — docs/ARCHITECTURE.md prose only (its known_hash sentence vs #289's resources sentence — combine both). server.py + mcp_tools_list_snapshot.json auto-merged cleanly with #302's tool addition; snapshot then regenerated via scripts/regen_tools_list_snapshot.py → byte-identical.

Integrated user flow — verified:

Evals: not run here (no OPENAI_API_KEY; Node 18, promptfoo needs Node 24). This PR changes no skill/eval/router files, so eval inputs are byte-identical to main — flagged not-empirically-run (CI doesn't gate evals).

@sumithr

sumithr commented Jun 2, 2026

Copy link
Copy Markdown
Owner Author

Live server smoke test — merged build run & prompted end-to-end

Started the actual merged sumo-qa server process and prompted it over the real MCP protocol. This PR's change-detection, exercised live through dispatch:

  • load_skill_context(skill,"full") → content_hash returned, body present ✓
  • same call + known_hash=<that hash> → changed:false, body omitted ✓
    • known_hash="wrong" → changed:true, body present ✓
  • known_hash advertised in the live load_skill_context schema ✓

Full routing flow also confirmed live (using_sumo_qa → routed tool → content). See #301 for the full transcript across all four PRs.

…ssive-skill-loading-pr6

# Conflicts:
#	docs/ARCHITECTURE.md
@sumithr
sumithr merged commit 1f16916 into main Jun 2, 2026
@sumithr
sumithr deleted the feat/issue-290-progressive-skill-loading-pr6 branch June 2, 2026 14:04
sumithr added a commit that referenced this pull request Jun 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.28.0](v0.27.0...v0.28.0)
(2026-06-02)


### Features

* **knowledge:** add per-entry and compact catalogue loaders
([#302](#302))
([38ece06](38ece06))
* **skills:** add content-hash digest + change-detection to partial
skill loads ([#304](#304))
([1f16916](1f16916))
* **skills:** expose skill index as additive MCP resources/templates
([#303](#303))
([0d8e662](0d8e662))


### Tests

* add cumulative token-budget tests + host docs for progressive skill
loading ([#301](#301))
([7ea5a82](7ea5a82))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
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.

[Task]: Progressive skill loading PR6 — content-hash digest / change-detection for partial loads

2 participants