Skip to content

harness: freeze and resume unregistered candidate ranking rules - #770

Draft
fake0fan wants to merge 2 commits into
InferMatrixLab:mainfrom
fake0fan:p0-s3-candidate-rules
Draft

fake0fan wants to merge 2 commits into
InferMatrixLab:mainfrom
fake0fan:p0-s3-candidate-rules

Conversation

@fake0fan

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #764

  • Accepted scope / delegation: task: #460 P0 — Harness rule slots: freeze, resume and replay candidate Indexer rules #764 slice S3, accepted by the owner @fake0fan in the owner decision; service-mode digest handling per the review reply. Implemented by Antigravity acting for @fake0fan.
  • Stacked on S2: this branch contains the S2 commit (knowledge: rebuild frozen ranking configurations and check declared weight spaces #769). Review the last commit only; it will be rebased onto main once S2 merges.
  • What this PR delivers: managed sessions accept an unregistered candidate ranking rule through --ranking-policy-file (mutually exclusive with --ranking-policy). The plan freezes the full configuration (with config_sha256 in ordinary plans) and records ranking_policy_source: configuration; the service manifest carries the same source and is cross-checked. Resume, Find and Read rebuild the rule from the frozen configuration through the injected resolver instead of the registry, so every search and read receipt carries the candidate. Candidate IDs cannot reuse registered names; named-policy plans keep their registry check.
  • What it does not deliver: replay (S4), experiment-declared space checks at session start (P1 controller), default bounds.

Anchors touched: none

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "08c4aba91170702523314f1c2024cc5f6f954a72",
  "human_only": false,
  "material_ai_authors": [
    {"tool": "Antigravity", "model_id": "claude-opus-5-5", "effort": "high", "role": "author"}
  ]
}

No protected path is changed; the policy status is expected to be Not applicable.

Changed artifacts and evidence

Requirement Actual change Check / evidence and result Remaining gap
Candidate start → resume → delivery, both modes apps/cli/arguments.py, apps/cli/__init__.py, harness/manager/_requests.py, _session.py, _state.py, harness/indexer/__init__.py, knowledge/ranking_policy.py tests/apps/test_session_candidate_ranking.py (AB/BA, packaged benchmark, service reuse): plan and manifest pin the candidate; Find/Read receipts carry it with the registry emptied none
Changed rule, digest drift, source tampering refused with zero writes same weights changed, unknown source, source removed, scoring version bumped: exit 2, session bytes unchanged none
Invalid candidate rejected before any write same registered-name reuse, negative weight, digest mismatch, wrong version, non-object/malformed/missing file, both flags: exit 2, no session directory none
Named-policy behavior unchanged same tests/apps/test_session_ranking_policy.py (#689) passes unchanged none
Documentation src/inferrsi/harness/README.md — none

Checks and dependencies

  • Checks actually run (result and tested scope): ruff check src tests tools passed; tests/apps/test_session_candidate_ranking.py, tests/apps/test_session_ranking_policy.py, tests/knowledge/test_ranking_policy.py passed (66 tests, service lanes via the Git wrapper below); full pytest run, see next item.
  • Failed, skipped, timed-out or not-run checks: local host has Git 2.34 while the repository requires Git ≥ 2.45. Service-reuse tests ran with a local test-only wrapper that emulates git ls-tree --format; nothing in the repository was changed for it. The full suite still fails 387 tests on this host; 386 fail identically on the documentation-only S1 head (a main baseline here), with --no-lazy-fetch/Git ≥ 2.45 errors and one SSH-dependent plugin test. The remaining one, tests/benchmark/test_moe_benchmark.py::test_deadline_cleans_detached_workers_but_preserves_unrelated_process, failed once under full-suite load and passed 6/6 in isolation on this and the stacked heads. CI with a supported Git is the authoritative run.
  • Dependencies / shared interfaces: depends on S2's RankingPolicy.from_configuration. Session runtime identity covers the changed modules, so sessions started on an earlier runtime resume only on that runtime. An installed-wheel start/resume outside the source tree (named in task: #460 P0 — Harness rule slots: freeze, resume and replay candidate Indexer rules #764) is not yet run.

Remaining work and Issue closure

  • Remaining Issue requirements / follow-up: installed-wheel start/resume receipt for this slice; S4.
  • Goal-acceptance owner or accepted closure delegation: @fake0fan.
  • Goal ready for acceptance? Not claimed.

…eight spaces

Add RankingPolicy.from_configuration to rebuild a policy from a frozen configuration or receipt, verifying fields, scoring version, canonical weights and digest. Add RankingSpace for experiment-declared editable weights with inclusive bounds and steps; undeclared fields stay at their defaults. Session behavior and named-policy receipts are unchanged.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
Managed sessions accept a candidate ranking configuration through --ranking-policy-file, mutually exclusive with --ranking-policy. The plan freezes its full configuration (with config_sha256 for ordinary plans) and records ranking_policy_source: configuration; the service manifest carries the same source. Resume, Find and Read rebuild the rule from the frozen configuration through the injected resolver instead of the registry, so search and read receipts carry the candidate. Candidate IDs cannot reuse registered names, and named-policy plans keep their registry check.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
@Dong1017 Dong1017 added area:harness Harness module: profile, A/B loop, quality gates, evidence reports area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters area:knowledge Knowledge line: packs, skill library, knowledge admission labels Nov 27, 2026

Copy link
Copy Markdown
Collaborator

inferRSI, acting for @amy-why-3459.

PR review verdict — DO NOT PASS

First independent review of #770 (S3 of #764; draft, stacked on #769).
Reviewed base 7626c58f8158986770f0515888572ebb550d1751 and head 08c4aba91170702523314f1c2024cc5f6f954a72.
Unique S3 commit: 08c4aba91170702523314f1c2024cc5f6f954a72 on parent b15402e0d2939180410af9fe0a68b458708c4e20.

I am not approving this head. Two blockers remain on the PR as it stands, even though the unique S3 commit looks consistent with the recorded service-mode decision.

  1. This head includes the unresolved S2 step-membership bug. The first commit is knowledge: rebuild frozen ranking configurations and check declared weight spaces #769 at b15402e0d2939180410af9fe0a68b458708c4e20. On that revision, RankingSpace.check accepts off-grid weights such as body=1 with step 3e-30, and body=1e30 with step 3, under the default Decimal context (see my comment on knowledge: rebuild frozen ranking configurations and check declared weight spaces #769). Merging or approving this stack would land that code. S3 itself does not call RankingSpace, but the PR head still contains it.

  2. This head does not merge onto current main. mergeable_state is dirty. The same session/CLI files S3 changes also changed on main in fix(apps): use the shared Dashboard for service-reuse campaigns #758 and Add task intake records and question prompts for inference workflows #706: src/inferrsi/apps/cli/__init__.py, src/inferrsi/apps/cli/arguments.py, src/inferrsi/harness/manager/_requests.py, _session.py and _state.py. After S2 is fixed and merged, this branch still needs a rebase onto current main and a re-check of those conflicted paths before approval.

Independent review of the unique S3 commit on this head (not an approval):

  • Managed start accepts --ranking-policy-file mutually exclusive with --ranking-policy. Ordinary plans freeze ranking_policy.receipt() (with config_sha256) and ranking_policy_source: configuration. Service-reuse plans freeze configuration() (no digest key) and the same source, and _control cross-checks plan vs manifest, then runs service_io.no_fingerprints. Resume, Find and Read with source == "configuration" rebuild through the injected resolver from the frozen mapping, not from the registry; named plans with no source keep the registry path. Candidate ids that reuse default or applicability are rejected before a session directory is written. That matches the owner reply 7212939652, not the still-unamended task: #460 P0 — Harness rule slots: freeze, resume and replay candidate Indexer rules #764 S3 table that asks for a digest in both modes. Once S1/task: #460 P0 — Harness rule slots: freeze, resume and replay candidate Indexer rules #764 reconcile that contract, S3 should stay aligned with the recorded exception rather than silently putting a digest into service records.
  • session_knowledge.py and campaign.py were listed in the S3 file list but are unchanged; that looks correct: the former already injects managed_ranking_policy, and the latter already accepts a RankingPolicy object.
  • Locally, tests/apps/test_session_candidate_ranking.py, tests/apps/test_session_ranking_policy.py and tests/knowledge/test_ranking_policy.py passed (73 tests) on this head, including ordinary and service-reuse start → Find/Read with the registry emptied, tamper refusals with zero writes, and invalid-candidate rejection before any session write. I did not run an installed-wheel start/resume outside the source tree; that remains an S3 acceptance item in task: #460 P0 — Harness rule slots: freeze, resume and replay candidate Indexer rules #764, as the PR already notes.
  • The S3 commit has Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author) and a DCO sign-off.
  • Accuracy and performance comparison evidence: not applicable (session freeze/resume of a ranking configuration; no model-output or speed claims).
  • Architecture / necessity: the new source flag and resolver branch belong in the session/indexer layer, with rebuild still in Knowledge. I did not find a redundant code or test change in the unique commit.

Please land a fixed S2 first, rebase this draft onto current main, and request re-review of the conflicted session/CLI paths and of the new head.

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

Labels

area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters area:harness Harness module: profile, A/B loop, quality gates, evidence reports area:knowledge Knowledge line: packs, skill library, knowledge admission

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants