Skip to content

test(openclaw): fix agent_end hook tests after #1968 context change - #2266

Merged
nicoloboschi merged 1 commit into
mainfrom
fix/openclaw-hooks-integration-test-1968
Jun 17, 2026
Merged

nicoloboschi merged 1 commit into
mainfrom
fix/openclaw-hooks-integration-test-1968

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Summary

Fixes the test-openclaw-integration failure on main.

#1968 ("strip runtime metadata from memory content") changed prepareRetentionTranscript so routing metadata is no longer prepended as a system [context] message in the transcript — it now travels via the retain API context field. That PR updated index.test.ts but missed three agent_end hook assertions in hooks.integration.test.ts, which still expected the old shape:

AssertionError: expected [ { role: 'user', … } ] to deeply equal [ { role: 'system', … }, … ]
AssertionError: expected '1' to be '2'

Changes (test-only)

  • Transcript expectations no longer start with { role: 'system', content: '[context]…' }.
  • message_count now matches the structured turn length without the system pad: 1 for a single-user turn, 2 for a last user+assistant turn.

Verified against src/index.ts: prepareRetentionTranscript prepends no system message and returns messageCount = structured.length. The integration tests are apiReachable-guarded (run against the live API in CI), so CI is the validator.

…em message

#1968 moved routing metadata out of the transcript (it no longer prepends a
'[context]' system message) and into the retain API context field, but left
three agent_end integration assertions on the old shape:
- transcript no longer starts with a {role:'system', '[context]...'} entry
- message_count reflects the structured turn length without the system pad
  (1 for a single-user turn, 2 for the last user+assistant turn)

Updates index.test.ts's sibling integration tests to match.
@nicoloboschi
nicoloboschi merged commit d8665d7 into main Jun 17, 2026
80 checks passed
@nicoloboschi
nicoloboschi deleted the fix/openclaw-hooks-integration-test-1968 branch June 17, 2026 13:40
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