Repository navigation
test(auto-reply): expect the persona icon that replies actually carry - #125
Merged
Merged
Conversation
The unit suite is red on main: 8 tests assert reply text without the persona icon that runReplyAgent has been adding since b60f198. resolvePersonaIcon always returns an icon — it falls back to the "default" persona — and applyPersonaPrefix (agent-runner.ts:540) applies it unconditionally, so every non-empty reply is prefixed. The assertions predate the feature. This went unnoticed because the code jobs only run on code-touching PRs, and recent merges to main were docs-only: the last green CI run on main skipped checks, checks-windows, check and build-artifacts entirely. A green tick on main did not mean the tests had run. Two different fixes, because the tests differ in what they are about: - agent-runner.misc.runreplyagent and reply.block-streaming assert the delivered payload, so they now name the prefix through a PERSONA_PREFIX constant — one place to change if the default icon moves. - reply.media-note and reply.raw-body only use the text as an incidental "a reply came back" check while testing prompt plumbing and directive parsing. They strip the icon via a new exported stripPersonaIcon, rather than hardcode one. media-note resolves to the FINANCE icon, and it should not: hasKeyword is a plain substring match (persona.ts:88-91), so "eth" matches "whether" and "sol" matches "console". Baking that into an unrelated test would enshrine a misfiring heuristic. The heuristic itself is left alone here — it is a product decision, not a test fix. 6614 of 6615 unit tests now pass. The one remaining failure, discovery.test.ts "blocks suspicious ownership when uid mismatch is detected", is an artifact of running the suite as root: the check trusts root-owned files by design (discovery.ts:127-128, `stat.uid !== params.uid && stat.uid !== 0`), so a root-created fixture is legitimately not blocked. It passes on CI's non-root runner and is deliberately untouched. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
main's unit suite is red, and has been for a while
8 tests assert reply text without the persona icon that
runReplyAgenthas been adding sinceb60f19809.resolvePersonaIconalways returns an icon — it falls back to thedefaultpersona — andapplyPersonaPrefix(agent-runner.ts:540) applies it unconditionally, so every non-empty reply is prefixed. The assertions predate the feature.Why nobody noticed
The code jobs only run on code-touching PRs, and recent merges to main have been docs-only. The last green CI run on main (
016cb77d) skippedchecks,checks-windows,checkandbuild-artifactsentirely — onlycheck-docs,docs-scopeandsecretsran.A green tick on main did not mean the tests had run. I initially misread that tick as evidence these failures were mine; they were not.
Two fixes, because the tests differ in what they test
agent-runner.misc.runreplyagent,reply.block-streamingPERSONA_PREFIXconstantreply.media-note,reply.raw-bodystripPersonaIconA pre-existing bug this surfaced (not fixed here)
reply.media-noteresolves to the finance icon 🤖💵, which it should not.hasKeywordis a plain substring match (persona.ts:88-91):So
"eth"matches "whether","sol"matches "console","trade"matches "traded". Ordinary words will mis-route the persona icon in production.I deliberately did not hardcode 🤖💵 into that test, because it would enshrine the misfire. I also have not changed the heuristic — word-boundary matching is a product decision, not a test fix. Flagging it for a follow-up.
Verification
oxlintclean on all 5 changed files.tscerrors (the 2 inserver.chat.gateway-server-chat-b.e2e.test.tsare pre-existing on main, verified by stashing).The one remaining local failure is not a real one:
discovery.test.ts"blocks suspicious ownership when uid mismatch is detected" fails only because I ran the suite as root. The check trusts root-owned files by design (discovery.ts:127-128,stat.uid !== params.uid && stat.uid !== 0), so a root-created fixture is legitimately not blocked. It passes on CI's non-root runner — deliberately untouched.Review asks
stripPersonaIconis a new production export used only by tests. Reasonable (it is symmetric withapplyPersonaPrefixand reuses the existingICON_PREFIX_RE), or should it live in a test helper?@codex review