Skip to content

perf(publication): reuse public presentation verdicts between changes - #946

Draft
Haoming9527 wants to merge 2 commits into
work/872-scan-metadatafrom
work/872-presentation-cache
Draft

Haoming9527 wants to merge 2 commits into
work/872-scan-metadatafrom
work/872-presentation-cache

Conversation

@Haoming9527

@Haoming9527 Haoming9527 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #872. Stacked on #945 (work/872-scan-metadata).

What was wrong

Every admitted PTC loader callback assembled the entire public prompt again to obtain a presentation boolean. With ten callbacks in one step, the real host fixture performed 12 assemblies (11 probes). Native/discovery callbacks and result admission also repeated this inspection.

The change

Cache the final public probe verdict by prompt service and exact agent identity. Owned public prompt/tool change listeners invalidate all verdicts; disposal removes reuse, unobserved deployments fall back to a fresh probe, and invalidated asynchronous probes cannot authorize execution or overwrite a newer verdict. Callbacks retain live scope/definition/grant checks and compare the revision across asynchronous admission. No private executor API, dependency, schema, output limit or permission contract changes.

Includes bilingual documentation, changelog, three cache regressions, a real-host ten-callback regression, reproducible benchmark and every warmup/measured sample with source hashes.

Validation

  • npm run build: passed.
  • Presentation/precheck/PTC/discovery/projection/file-publication filters: 17 suites passed, 0 failed, 0 skipped.
  • Publication/authority/persistent admission/mode/shared-source/inheritance/result-storage filters: 14 suites passed, 0 failed, 0 skipped, with the real PR perf(search): reuse directory-relative metadata snapshots #945 worker.
  • Behavioral red/green: the new precheck regression on the before checkout fails with 11 probes versus expected 1 (2 other checks pass); candidate passes all 3 checks, including rejection after a same-step executor change.
  • git diff --check and source-size gate: passed.
  • 300 measured steps after 30 retained warmups per arm; ten SDK loader callbacks per step. Identical results across 3,000 calls in each arm; retained callbacks refused after executor switch in both arms.
Measurement Before p50 / p95 After p50 / p95
Loader callback 13.39 / 18.12 ms 0.42 / 0.80 ms
Step preparation 15.49 / 22.28 ms 15.61 / 20.24 ms
Preparation + ten callbacks 153.17 / 181.22 ms 20.31 / 25.79 ms
Total assemblies per step 12 2

This is a publication benchmark with real host services and a resident fixture that rejects execution. It excludes worker work, run_code compilation, shell and model requests. The full 106-operation scenario, full orchestration SLO and shell performance acceptance remain unmeasured or unmet. This PR does not close #872 or authorize a runtime release.

Pull-request-triggered CI: https://github.com/T-Auto/dsh-ops/actions/runs/43613610235 — all 10 jobs passed, including CI required and the Windows/Linux/macOS full release gates. The first run exposed a stale test assumption: ptc.test waited for an assembly despite a valid cache. The race fixture now explicitly invalidates the cache and fails if execution bypasses its barrier. The full PTC suite passes locally with normal staged-worker resolution; the assertion that an executor change prevents worker dispatch remains intact.

Environment

Windows x64 10.0.26300, Ryzen 7 6800HS, Node 26.12.1, locked dependencies. Base #945 at 9a626c16fe64e092bf25b8269073d15248e1628c; before host source is #944 at 24ac360551c1336453b78268090574f97a1de50a (unchanged by #945). No merge, tag or release.

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