Skip to content

fix(hermes-adapter): read singular traceId from turn.end per core contract#2095

Open
fancyboi999 wants to merge 1 commit into
MemTensor:mainfrom
fancyboi999:fix/hermes-turn-end-trace-id
Open

fix(hermes-adapter): read singular traceId from turn.end per core contract#2095
fancyboi999 wants to merge 1 commit into
MemTensor:mainfrom
fancyboi999:fix/hermes-turn-end-trace-id

Conversation

@fancyboi999

Copy link
Copy Markdown
Contributor

What

MemTensorProvider._end_turn reads the plural traceIds from the turn.end bridge response, but the core contract (agent-contract/memory-core.ts onTurnEnd, line 205) returns a singular traceId:

onTurnEnd(result: TurnResultDTO): Promise<{ traceId: string; episodeId: EpisodeId }>;

So against the real core, _last_trace_id is always empty and verifier feedback silently falls back to episode scope — trace-level binding never happens.

Fix

Read the singular traceId first; keep the plural traceIds form as a fallback for forward compatibility. Pipeline test's FakeBridge updated to return the contract-shaped response, plus an assertion that the captured trace id round-trips into feedback submission.

Provenance

Found via real-bridge E2E while investigating #1910. Originally part of #1911; the process-leak half of that PR was superseded by #2034 (thanks @CarltonXiang — the layered approach there is more robust than mine), so this PR carries only the remaining contract fix, rebased onto current main.

Verification

  • ruff check / ruff format --check clean on both changed files.
  • python -m unittest over apps/memos-local-plugin/tests/python/77/77 pass locally (macOS, Python 3.12).

Heads-up: unrelated import breakage on current main

Running the plugin tests on current main fails before this change is even reached: memos_provider/__init__.py:68 imports MemosHttpClient from bridge_client, but that class is not defined anywhere in the repo (git grep "class MemosHttpClient" → no hits; looks like the pr/may27-fixes merge brought in the usages without the class). I verified this PR's 77-test pass with a local throwaway stub for that class; the stub is not part of this PR. Filing a separate issue for it.

…tract

Found by real-bridge E2E for MemTensor#1910: the core contract
(agent-contract/memory-core.ts onTurnEnd) returns
{ traceId, episodeId }, but the adapter read the plural `traceIds`,
so `_last_trace_id` was always empty against the real core and
verifier-feedback never achieved trace-level binding (silently fell
back to episode scope). Pre-existing bug on main, independent of the
process-leak fix; the plural form is kept as a fallback.
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.

2 participants