Skip to content

fix(sources): profile-qualify Hermes ATIF/ATOF observer session identity - #3224

Merged
Sinity merged 1 commit into
masterfrom
feature/ingest/hermes-atif-atof-topology-projection
Jul 20, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/ingest/hermes-atif-atof-topology-projection

Conversation

@Sinity

@Sinity Sinity commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the Hermes ATIF/ATOF observer-evidence session-identity collapse described in polylogue-fs1.14 by threading a profile-qualified join key through the ATIF/ATOF parsers, and by asserting a real session_links parent edge back to the state-db conversational session instead of leaving that correlation as a read-side-only naming convention.

Problem

Two independent Hermes installs (profiles) can legitimately reuse the same raw Hermes session id — hermes_state.py's own state.db parser already accounts for this by profile-qualifying its conversational session id (<raw_id>@profile-<key>, hashed from the install root directory). The ATIF/ATOF observer-evidence session identity in hermes_spans.py did not: it was always observer:<raw_id>, with no profile qualifier at all, so ATIF/ATOF evidence from two different installs sharing a raw session id silently collapsed onto one archive session.

This was compounded by the existing read-side correlation helper, hermes_observer_session_id_for: given a real qualified conversational session id, it stripped the @profile-<key> suffix before building the observer id — discarding the exact information that would have prevented the collision, even for the one cross-artifact join path that already existed.

Separately, neither ATIF nor ATOF ever asserted a session_links parent edge back to the state-db conversational session — the module docstring explicitly called this out as deferred ("NOT materialized into topology_edges/session_links in this pass").

Solution

  • Extracted the profile-key hashing/qualification helpers (previously private, duplicated only in hermes_state.py) into a new shared module, polylogue/sources/parsers/hermes_identity.py (profile_key, qualified_session_id, split_qualified_session_id). Both hermes_state.py and hermes_spans.py now compute the join key from this single source of truth.
  • parse_atif_document/parse_atof_stream (hermes_spans.py) now accept an optional profile_root: Path | None — the directory the raw artifact was acquired from, mirroring hermes_state.parse_state_db's own convention. When known, both the observer session identity (observer:<raw_id>@profile-<key>) and a parent_session_provider_id (<raw_id>@profile-<key>, matching the conversational session's own id) are asserted.
  • polylogue/sources/dispatch.py: wired profile_root=Path(source_path).parent at all three call sites (_parse_lowered_spec's ATOF/ATIF branches and parse_stream_payload's Hermes branch), deriving it from the already-threaded source_path/spec.source_path.
  • Once parent_session_provider_id is asserted, the existing, unmodified generic session_links write/resolution machinery in archive_tiers/write.py picks it up: it resolves the edge once the target conversational session is ingested, or leaves it explicitly unresolved (visible debt, never silently dropped) otherwise. No changes were made to that file (owned by another lane).
  • Fail-closed: when profile_root is None (unknown at parse time), no parent edge is asserted and the observer session id stays unqualified — a wrong guess would silently correlate evidence with the wrong install, which is worse than an unresolved correlation.
  • Added a parent_session_link fidelity capability to both ATIF's and ATOF's import_fidelity_declaration output, reflecting whether the parent edge was asserted (inferred) or withheld (absent).

Scope notes / explicitly not done

  • hermes_verification.py (the separate verification-ledger artifact family) has the identical unqualified-id / qualifier-stripping pattern, but is not named in this bead's design (fs1.14 is scoped to "ATIF+ATOF"). Left as a follow-up rather than expanding scope in this PR.
  • Subagent-delegation topology_edges materialization from subagent_trajectories (ATIF) / hermes.subagent.* marks (ATOF) remains explicitly deferred/absent, consistent with the existing fidelity declarations. No real subagent_trajectories evidence has been observed to verify that shape (per the existing module docstring), and materializing it would require the child session to assert its own parent (the pattern every other session_links producer in this archive uses) — the parent-side ATOF/ATIF document only knows the child's id, not the reverse, and asserting on the child's behalf would need new write-path machinery outside archive_tiers/write.py's current generic contract, which is out of this lane's scope.
  • "Conflicting parent identifier fails closed or renders an explicit conflict" (bead AC): satisfied by the existing, generic session_links resolution machinery, unchanged here — an asserted dst_native_id that never resolves stays unresolved forever (visible debt), and cycle detection/quarantine is already generic across all parsers. This PR's job was correctly asserting the join key so that machinery can act on it, not duplicating it.

Verification

  • devtools test tests/unit/sources/parsers/test_hermes_spans.py tests/unit/sources/parsers/test_hermes_state.py tests/unit/sources/parsers/test_hermes_lifecycle.py tests/unit/sources/test_hermes_import_explain.py tests/unit/sources/test_hermes_export_contract.py tests/unit/pipeline/test_hermes_raw_identity.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_live_watcher_catchup_order.py tests/unit/sources/test_dispatch_payloads.py tests/unit/sources/test_provider_completeness.py tests/unit/sources/test_hermes_source_freshness_integration.py — 167 passed.
  • mypy --strict on all touched source files — no issues found.
  • devtools verify --quick — exit 0 (ran twice: once locally after render topology-projection/render topology-status regen for the new hermes_identity.py module, once again via the pre-push hook).
  • Not run: devtools verify --all / the full non-integration suite — left to CI per repo policy (per-PR CI intentionally skips the heavy test suite; it runs post-merge on master).

Ref polylogue-fs1.14

Problem: two independent Hermes installs (profiles) can legitimately
reuse the same raw Hermes session id. The ATIF/ATOF observer-evidence
session identity (`observer:<raw_id>`) carried no profile qualifier at
all, so evidence from different installs silently collapsed onto one
archive session whenever that happened. Worse, the read-side
correlation helper (`hermes_observer_session_id_for`) discarded the
`@profile-<key>` qualifier off a real qualified conversational session
id before building the observer id, so even the one existing
cross-artifact join was already unsafe. Neither ATIF nor ATOF asserted
a `session_links` parent edge back to the state-db conversational
session at all -- the module docstring explicitly deferred it.

Solution: extract the profile-key hashing/qualification helpers
duplicated in hermes_state.py into a new shared
`polylogue/sources/parsers/hermes_identity.py` module (single source
of truth for the join key both hermes_state.py and hermes_spans.py
use). Thread `profile_root` (the directory the raw artifact was
acquired from, mirroring hermes_state.parse_state_db's own
convention) through `parse_atif_document`/`parse_atof_stream` and
their three dispatch.py call sites, deriving it from the lowered
spec's/stream's `source_path`. When the profile is known, both the
observer session identity and a `parent_session_provider_id` pointing
at the qualified conversational session id are asserted -- this makes
the existing, generic `session_links` write/resolution machinery in
`archive_tiers/write.py` (unchanged) resolve the edge against the
state-db session once ingested, or leave it explicitly unresolved
(visible debt) otherwise. When the profile is unknown, no parent edge
is asserted at all (fail closed) rather than guessing an unqualified,
potentially cross-profile-colliding join key. Added a
`parent_session_link` fidelity capability to both ATIF and ATOF
declarations reflecting which case applied.

Scope notes: `hermes_verification.py` (the separate verification-
ledger artifact family) has the identical unqualified-id pattern but
is not named in this bead's design and is left as a follow-up rather
than expanding scope. Subagent-delegation topology_edges materialization
from `subagent_trajectories`/ATOF `hermes.subagent.*` marks remains
explicitly deferred/absent, consistent with the existing fidelity
declarations -- the module docstring already documents that no real
subagent_trajectories evidence has been observed to verify that
shape, and the "child announces its own parent" direction the rest of
the archive's session_links mechanism relies on is not something the
parent-side ATOF/ATIF document can assert on the child's behalf
without new write-path machinery outside this lane's scope.

Verification:
- devtools test tests/unit/sources/parsers/test_hermes_spans.py
  tests/unit/sources/parsers/test_hermes_state.py
  tests/unit/sources/parsers/test_hermes_lifecycle.py
  tests/unit/sources/test_hermes_import_explain.py
  tests/unit/sources/test_hermes_export_contract.py
  tests/unit/pipeline/test_hermes_raw_identity.py
  tests/unit/sources/test_live_watcher.py
  tests/unit/sources/test_live_watcher_catchup_order.py
  tests/unit/sources/test_dispatch_payloads.py
  tests/unit/sources/test_provider_completeness.py
  tests/unit/sources/test_hermes_source_freshness_integration.py
  -- 167 passed.
- mypy --strict on all touched source files -- no issues.
- devtools verify --quick -- exit 0 (includes render-all/topology
  regen for the new hermes_identity.py module).
- Not run: devtools verify --all / full non-integration suite (left
  to CI per repo policy: per-PR CI skips the heavy `test` suite).

Ref polylogue-fs1.14

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: eb605171-e4d3-44f0-9ef9-4c897660624a

📥 Commits

Reviewing files that changed from the base of the PR and between 3353376 and 3073355.

📒 Files selected for processing (9)
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/sources/dispatch.py
  • polylogue/sources/parsers/hermes_identity.py
  • polylogue/sources/parsers/hermes_spans.py
  • polylogue/sources/parsers/hermes_state.py
  • tests/unit/sources/parsers/test_hermes_spans.py
  • tests/unit/sources/test_dispatch_payloads.py
  • tests/unit/sources/test_live_watcher.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ingest/hermes-atif-atof-topology-projection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity

Sinity commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

Coordinator review stand-in (CodeRabbit rate-limited — no findings produced).

Read the full diff. Assessment:

  • Real identity bug, correctly rooted: observer-evidence sessions used bare observer:<raw_id> while conversational sessions were profile-qualified (<raw_id>@profile-<key>); hermes_observer_session_id_for even stripped the qualifier before building the observer id. Two Hermes profiles sharing a raw session id collapsed onto one archive session — exactly the bead's named failure.
  • Single source of truth: new hermes_identity.py extracts the qualifier helpers; hermes_state.py switched to it (pure dedup); hermes_spans.py consumes it for both the observer id and the new parent_session_provider_id edge.
  • Fail-closed on unknown profile: parent edge asserted only when profile_root is known (dispatch wires Path(source_path).parent at all three ATIF/ATOF call sites); None → no edge, tested explicitly. Link resolution rides the existing generic session_links path — archive_tiers/write.py untouched, respecting hot-file ownership.
  • Anti-vacuity: test_two_profiles_with_the_same_raw_session_id_do_not_collapse fails if qualification is reverted.
  • Topology projection regenerated for the new module (render all --check green — the gotcha that usually bites here).
  • Residual flagged, agreed: hermes_verification.py has the same collapse-and-strip pattern, outside this bead's ATIF/ATOF scope — should get a follow-up bead; subagent-topology materialization stays deferred consistent with existing fidelity declarations.

Verification per PR body: 167 focused tests green across 11 files, mypy --strict clean, quick-gate green (2×). Merging.

@Sinity
Sinity merged commit 37fc90c into master Jul 20, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the feature/ingest/hermes-atif-atof-topology-projection branch July 20, 2026 19:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3073355b1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/sources/dispatch.py Resolved
Sinity added a commit that referenced this pull request Jul 20, 2026
…test

Problem: rebasing this branch (artifact-family-qualified Hermes observer
ids, observer:atif:<id> / observer:atof:<id>) onto master (which had
independently gained profile qualification for the same ids via #3224,
observer:<id>@PROfile-<key>) left docs/hermes-operators.md describing only
the pre-#3224 behavior (helpers "stripping any @PROfile-<key> qualifier"),
and left no test proving the two fixes compose rather than one silently
overriding the other.

What changed:
- docs/hermes-operators.md: "Session identity" section and "What Polylogue
  cannot claim" item 1 now describe the composed scheme -- ATIF/ATOF ids are
  both artifact-qualified and, when profile_root is known, profile-qualified
  (observer:atif:<id>@PROfile-<key> / observer:atof:<id>@PROfile-<key>), and
  hermes_atif_session_id_for/hermes_atof_session_id_for now PRESERVE the
  profile qualifier rather than stripping it. Notes that
  hermes_verification.py's helper still strips it (deliberately out of this
  fix's scope, per #3224's own scope notes).
- tests/unit/sources/parsers/test_hermes_spans.py: adds
  test_two_profiles_times_two_artifact_families_compose_to_four_distinct_sessions,
  which ingests both an ATIF trajectory and an ATOF stream for the same raw
  Hermes session id under two different profile roots and asserts 4 distinct
  provider_session_ids, 2 distinct parent_session_provider_id values (one per
  profile, shared correctly across that profile's ATIF+ATOF pair), and that
  the read-side hermes_atif_session_id_for/hermes_atof_session_id_for
  helpers resolve each profile's conversational id back to that same
  profile's observer sessions only.
- docs/plans/topology-target.yaml, docs/topology-status.md: regenerated
  (devtools render topology-projection && render topology-status) to reflect
  the composed module set after rebase.
- ruff format on the two touched test files (pre-existing formatting drift
  surfaced by the rebase, not new content).

Verification:
- devtools test tests/unit/sources/parsers/test_hermes_spans.py
  tests/unit/insights/test_hermes_topology_projection.py
  tests/unit/sources/test_dispatch_payloads.py
  tests/unit/sources/test_live_watcher.py -- 134 passed.
- devtools verify --quick -- exit 0 (ruff format/check, mypy --strict,
  render all --check, topology/layering/closure-matrix/manifests/
  ci-workflows/doc-commands/docs-coverage/test-infra-currency/
  test-clock-hygiene/pytest-timeout-overrides/degrade-loudly all ok).

Ref polylogue-fs1.14

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 20, 2026
…tity (#3227)

## Summary

`hermes_verification.py` retained the exact unqualified observer-id
collapse
pattern that PR #3224 fixed for ATIF/ATOF (`hermes_spans.py`). This PR
mirrors that fix for the Hermes verification-ledger importer.

## Problem

Two Hermes installs (profiles) can legitimately reuse the same raw
session
id. `hermes_verification.observer_session_provider_id` /
`hermes_verification_session_id_for` built a bare
`verification:<raw_id>`
identity and stripped any `@profile-<key>` qualifier when mapping back
from
a conversational session id, so two installs' verification-ledger
evidence
(lint/typecheck/build/test command outcomes) silently collapsed onto one
archive session.

## Solution

- `observer_session_provider_id(hermes_session_id, profile_key=None)`
and
`hermes_verification_session_id_for` now thread an optional profile key
  through `hermes_identity.qualified_session_id` /
`split_qualified_session_id` -- the exact shared helper
`hermes_spans.py`
and `hermes_state.py` already use. The `verification:` family prefix
stays
distinct from ATIF/ATOF's `observer:` family even when both qualify the
  same raw id against the same profile.
- `parse_verification_evidence_db` /
`parse_verification_evidence_db_payload`
accept `profile_root: Path | None`, compute a profile key when known,
and
assert `parent_session_provider_id` back to the state-db conversational
  session only when the profile root is known (fail-closed: no edge is
  safer than a wrong one).
- Added a `parent_session_link` fidelity capability, aggregated across
  sessions, mirroring `hermes_spans._parent_session_link_capability`.
- Wired `profile_root=Path(spec.source_path).parent` (or `path.parent`)
at
every verification-evidence call site: `dispatch.py`,
`import_explain.py`,
  `source_parsing.py`, `live/batch.py`.
- Left `revision_backfill.py`'s existing call untouched per scope (it
already
  fails closed with `profile_root` defaulting to `None`).
- Did not touch `hermes_spans.py` / `hermes_identity.py` (consumed
  read-only) or the ATIF/ATOF call sites -- those are owned by another
  active lane.

## Verification

- `devtools test tests/unit/sources/parsers/test_hermes_verification.py
tests/unit/sources/test_dispatch_payloads.py
tests/unit/sources/test_hermes_import_explain.py
tests/unit/sources/test_hermes_source_freshness_integration.py
tests/unit/insights/test_hermes_verification_coverage.py
tests/unit/sources/test_live_watcher_catchup_order.py
tests/unit/core/test_sampling.py
tests/unit/sources/test_parsers_local_agent.py` -> `103 passed`
- `mypy --strict` on the 5 touched production modules -> `Success: no
issues found in 5 source files`
- `devtools verify --quick` -> `exit_code: 0`
- **Anti-vacuity**: temporarily reverted the profile-key qualification
in
  `observer_session_provider_id` (collapsed back to unconditional
  `verification:<raw_id>`) and re-ran the new collapse/family-prefix/
  dispatch-wiring tests -- all 3 failed with the expected unqualified-id
  assertion mismatches. Restored the fix; tests green again.

Ref polylogue-y9zx

Co-authored-by: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 20, 2026
…test

Problem: rebasing this branch (artifact-family-qualified Hermes observer
ids, observer:atif:<id> / observer:atof:<id>) onto master (which had
independently gained profile qualification for the same ids via #3224,
observer:<id>@PROfile-<key>) left docs/hermes-operators.md describing only
the pre-#3224 behavior (helpers "stripping any @PROfile-<key> qualifier"),
and left no test proving the two fixes compose rather than one silently
overriding the other.

What changed:
- docs/hermes-operators.md: "Session identity" section and "What Polylogue
  cannot claim" item 1 now describe the composed scheme -- ATIF/ATOF ids are
  both artifact-qualified and, when profile_root is known, profile-qualified
  (observer:atif:<id>@PROfile-<key> / observer:atof:<id>@PROfile-<key>), and
  hermes_atif_session_id_for/hermes_atof_session_id_for now PRESERVE the
  profile qualifier rather than stripping it. Notes that
  hermes_verification.py's helper still strips it (deliberately out of this
  fix's scope, per #3224's own scope notes).
- tests/unit/sources/parsers/test_hermes_spans.py: adds
  test_two_profiles_times_two_artifact_families_compose_to_four_distinct_sessions,
  which ingests both an ATIF trajectory and an ATOF stream for the same raw
  Hermes session id under two different profile roots and asserts 4 distinct
  provider_session_ids, 2 distinct parent_session_provider_id values (one per
  profile, shared correctly across that profile's ATIF+ATOF pair), and that
  the read-side hermes_atif_session_id_for/hermes_atof_session_id_for
  helpers resolve each profile's conversational id back to that same
  profile's observer sessions only.
- docs/plans/topology-target.yaml, docs/topology-status.md: regenerated
  (devtools render topology-projection && render topology-status) to reflect
  the composed module set after rebase.
- ruff format on the two touched test files (pre-existing formatting drift
  surfaced by the rebase, not new content).

Verification:
- devtools test tests/unit/sources/parsers/test_hermes_spans.py
  tests/unit/insights/test_hermes_topology_projection.py
  tests/unit/sources/test_dispatch_payloads.py
  tests/unit/sources/test_live_watcher.py -- 134 passed.
- devtools verify --quick -- exit 0 (ruff format/check, mypy --strict,
  render all --check, topology/layering/closure-matrix/manifests/
  ci-workflows/doc-commands/docs-coverage/test-infra-currency/
  test-clock-hygiene/pytest-timeout-overrides/degrade-loudly all ok).

Ref polylogue-fs1.14

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 20, 2026
…4/fs1.2.1) (#3231)

## Summary

Closes fs1.14's last remaining scope item (subagent-delegation topology
materialization from Hermes ATIF `subagent_trajectories` and ATOF
`hermes.subagent.*` marks) and fs1.2.1's residual detector-tightness and
fidelity-honesty ACs, all against the two real redacted producer
fixtures
already checked into the repo.

## Problem

`hermes_spans.py` already parsed ATIF `subagent_trajectories` entries
and
ATOF `hermes.subagent.*` marks into `hermes_subagent_span` summary
events,
and `hermes_topology_projection.py` already surfaced them read-side as
`subagent_evidence` -- but both explicitly declared `topology_edges` as
permanently `absent`: the delegation evidence never became a real
`session_links` graph edge. Separately, fs1.2.1 had residual ACs
(detector
tightness proof, fidelity-band honesty) that were unaddressed after the
merged `unpaired-scope-debt` and shared-file/single-session fixes
(#3103,
#3113).

## Solution

**Materialization** (`polylogue/sources/parsers/hermes_spans.py`):
`parse_atof_stream` and `parse_atif_document` now materialize a real
`session_links` parent edge (`branch_type=subagent`) for a subagent
reference when the child session id is producer-positive, non-self-
referential, unambiguous (no two different parents claiming the same
child), and a profile root is known -- the same fail-closed pattern
fs1.14's
profile-qualification fix already established. On the ATOF route, when
the
child's own trace records aren't present in the same batch, a minimal
delegation-evidence-only session is materialized so the edge still lands
in
the archive (content-hash full-replace later reconciles it if the
child's
real trace is separately ingested). On the ATIF route,
`subagent_trajectories`
entries carry their own `steps`, so the child gets real parsed content,
not
a stub. `parse_atif_document`'s return type changed from `ParsedSession`
to
`list[ParsedSession]` (parent + any materialized children);
`dispatch.py`'s
lowering was updated accordingly (one call site).

Each observing session's own `hermes_subagent_span` event now carries a
`delegation_edge_asserted` flag recording whether materialization
actually
happened, so `import_fidelity_declaration`'s `topology_edges` capability
(and `hermes_topology_projection.HermesSubagentEvidenceRef.
delegation_edge_materialized`) can report it without cross-session
lookups.
ATOF's mapping is proven end-to-end against the real NeMo Relay ATOF
fixture's `hermes.subagent.start` mark (`topology_edges: exact`); ATIF's
`subagent_trajectories` mapping has no real-fixture evidence yet (every
real
ATIF export sampled so far carries an empty/absent list), so it stays
`inferred`, never `exact`.

**Detector tightness (fs1.2.1 AC2):** added a negative test proving the
ATOF structural detector (`looks_like_atof_payload`) rejects a
repository-invented marker-only payload -- ATOF never had an invented
marker historically (unlike ATIF's pre-fix `polylogue_artifact:
"hermes_atif_trace"`), so this closes the "reject the marker" half of
AC2
for both artifact families. Also added a `detect_provider`-level
assertion
on the existing ATIF marker-rejection test, proving rejection through
the
real dispatch entrypoint, not just the low-level predicate.

**Fidelity honesty (fs1.2.1 AC5):** audited every `status="exact"` /
`verified_by_real_fixture` site in `hermes_spans.py`. The pre-existing
`llm_request_spans`/`tool_execution_spans` (ATIF) and
`llm_request_spans`/`tool_execution_spans`/`decision_points`/
`error_taxonomy`/`subagent_delegation`/`context_events` (ATOF)
capabilities
were already correctly gated (real-fixture-proven mapping, "exact" means
the
*mapping* is proven, matching the precedent already established and
tested
elsewhere in this file for exactly this reason) -- no downgrade needed.
The
new `topology_edges` capability is gated the same way: `exact` only when
the
real ATOF fixture proves both the field mapping and the edge
materialization
end-to-end; `inferred` on the ATIF route since no real fixture proves
that
mapping yet.

**Docs:** `docs/hermes-operators.md` had several claims that
`subagent_delegation` "never reaches `topology_edges`/`session_links`"
--
narrowed to describe exactly when an edge is and isn't materialized, and
updated the ATIF/ATOF capability example blocks to current observed
values.

## Per-bead AC matrix

**polylogue-fs1.14** (residual scope: subagent-delegation topology
materialization):
- Materialize parent/child delegation evidence as `session_links` parent
  references from producer-positive ids + profile qualification, fail
  closed otherwise: **satisfied** -- `hermes_spans.py`
(`_mark_delegation_edges_on_subagent_events`,
`_atif_subagent_child_session`,
  `_atof_subagent_delegation_stub_session`); see
  `test_real_atof_fixture_subagent_mark_materializes_delegation_edge`,
  `test_atof_subagent_mark_fails_closed_without_profile_root`,
  `test_atof_subagent_mark_fails_closed_on_self_reference`,

`test_atif_subagent_trajectory_materializes_delegation_edge_with_known_profile`,
  `test_atif_subagent_trajectory_fails_closed_without_profile_root`,
  `test_atif_subagent_trajectory_fails_closed_on_self_reference`.
- Extend `hermes_topology_projection.py` to surface the edges:
**satisfied**
-- `HermesSubagentEvidenceRef.delegation_edge_materialized`, read
straight
from the underlying event's `delegation_edge_asserted` payload flag;
kept
  shape-agnostic (no new coupling to `hermes_spans` internals).
- Anti-vacuity real-fixture test + fail-closed test: **satisfied** --
see
  above.
- Where the real fixture lacks subagent evidence (ATIF), keep the
capability
  declared absent/inferred: **satisfied** -- ATIF `topology_edges` stays
`inferred` even when materialized (never `exact`, no real fixture
proof).

**polylogue-fs1.2.1** (residual ACs 2 and 5):
- AC2 (detector tightness admits both real fixtures, rejects
marker-only):
  **satisfied** -- ATIF marker-rejection was already tested; added the
  `detect_provider`-level proof plus the ATOF equivalent

(`test_looks_like_atof_payload_rejects_a_repository_invented_marker_only_shape`).
Both real fixtures already pass detection (pre-existing tests,
unaffected).
- AC5 (fidelity exact only where real bytes prove the mapping):
**audited,
already satisfied except the new `topology_edges` capability**, which is
  now gated to the same standard (exact only for the real-fixture-proven
  ATOF route). No existing capability required downgrading.
- ACs 1, 3, 4, 6 (real-byte fixture acquisition, full per-event-class
producer match, ATOF replay/append semantics, mutation-sensitive tests):
  **already satisfied by prior merged work** (PRs #3103, #3113, #3224,
#3225 per the bead's own notes) -- not re-implemented here, out of this
  PR's stated residual scope.

## Verification

```
devtools test tests/unit/sources/parsers/test_hermes_spans.py tests/unit/sources/test_dispatch_payloads.py tests/unit/insights/test_hermes_topology_projection.py
# 56 passed in 3.89s

mypy --strict polylogue/sources/parsers/hermes_spans.py polylogue/insights/hermes_topology_projection.py polylogue/sources/dispatch.py tests/unit/sources/parsers/test_hermes_spans.py tests/unit/sources/test_dispatch_payloads.py
# Success: no issues found in 5 source files

devtools verify --quick
# exit_code 0 (format, lint, mypy, render all --check, topology/layering/
# closure-matrix/schema-roundtrip/manifests/ci-workflows/doc-commands/
# docs-coverage/test-infra-currency/test-clock-hygiene/pytest-timeout-
# overrides/degrade-loudly all pass)
```

Not run: full `devtools verify`/`--all` (testmon unseeded in this
worktree;
out of the requested synchronous-foreground scope) and integration
tests.

## Residual risk

- `topology_edges` materialization only handles the case observed in the
real fixture (one mark, one child, single batch). Two different parents
claiming the same child id in one batch is fail-closed (no edge) but not
independently unit-tested beyond code review -- low risk, same pattern
as
  the already-tested self-referential guard.
- ATIF child sessions reuse `_events_for_step`, so any future step-shape
addition to that function automatically applies to subagent children too
  (intentional, not drift).
- `parse_atif_document`'s return-type change (`ParsedSession` ->
  `list[ParsedSession]`) is a public-ish API change within
`polylogue.sources.parsers.hermes_spans`; the only production call site
  (`dispatch.py`) was updated, and a repo-wide grep confirmed no other
  caller exists.

Ref polylogue-fs1.14
Ref polylogue-fs1.2.1

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Hermes imports now recognize real ATIF documents and can represent
delegated subagent sessions.
* Subagent evidence now indicates when a concrete parent-child session
link was materialized.
* Delegated sessions can be created from available trajectory or stream
evidence, including minimal evidence-only sessions.

* **Bug Fixes**
* Improved session identity handling to prevent collisions between
parent and delegated sessions.
* Unsupported or ambiguous delegation references now fail closed without
creating topology links.

* **Documentation**
* Updated Hermes fidelity, topology, and session-correlation guidance to
reflect delegation behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 70.F034 / P1: fixed-already at the checked revision: Hermes dispatch now derives ATIF/ATOF profile roots with the shared profile_root_for_artifact helper. polylogue/sources/parsers/hermes_identity.py:72-74 climbs the known observability/nemo-relay/atif/atof directories, producing the same install root as state.db rather than hashing each immediate parent.

Only the rows listed above are dispositioned. Held findings remain open.

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