fix(hermes-adapter): read singular traceId from turn.end per core contract#2095
Open
fancyboi999 wants to merge 1 commit into
Open
fix(hermes-adapter): read singular traceId from turn.end per core contract#2095fancyboi999 wants to merge 1 commit into
fancyboi999 wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
MemTensorProvider._end_turnreads the pluraltraceIdsfrom theturn.endbridge response, but the core contract (agent-contract/memory-core.tsonTurnEnd, line 205) returns a singulartraceId:So against the real core,
_last_trace_idis always empty and verifier feedback silently falls back to episode scope — trace-level binding never happens.Fix
Read the singular
traceIdfirst; keep the pluraltraceIdsform as a fallback for forward compatibility. Pipeline test'sFakeBridgeupdated 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 --checkclean on both changed files.python -m unittestoverapps/memos-local-plugin/tests/python/— 77/77 pass locally (macOS, Python 3.12).Heads-up: unrelated import breakage on current
mainRunning the plugin tests on current
mainfails before this change is even reached:memos_provider/__init__.py:68importsMemosHttpClientfrombridge_client, but that class is not defined anywhere in the repo (git grep "class MemosHttpClient"→ no hits; looks like thepr/may27-fixesmerge 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.