Skip to content

fix(hooks): stop the Stop hook nudge reaching the user twice - #720

Merged
jeff-r2026 merged 5 commits into
Tencent:mainfrom
SaulMoro:fix/719-stop-hook-relay
Sep 22, 2026
Merged

jeff-r2026 merged 5 commits into
Tencent:mainfrom
SaulMoro:fix/719-stop-hook-relay

Conversation

@SaulMoro

@SaulMoro SaulMoro commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Stop hook nudge reached the user twice. Claude Code prints the Stop payload as "Stop hook feedback", and the payload opened with an order addressed to the model, so the user read the order and then read the message again from the model. The reminder documented in docs/usage-guide.md carries no such line.

The order belongs to the message, not to the channel that carries it:

 contributeCheckHandler(hint, tool)
-  buildHint()                          always prepends "Print the following ... verbatim"
-  formatStopHookOutput(hint, tool)     wraps the JSON around it
+  relayWhenHidden(hint, tool)          prepends it only when the host shows nothing
+  formatStopHookOutput(hint, tool)     shape only
 votesSyncHandler(nudge, tool)
   formatStopHookOutput(nudge, tool)    never relayed: it instructs the model

Which leaves one rule per delivery path, and no path where the user reads an order meant for the model:

Path Field Host shows it Relay order
Claude, unknown tool Stop hookSpecificOutput.additionalContext yes no
Cursor followup_message no yes
CodeBuddy, WorkBuddy, Codex family UserPromptSubmit additionalContext, after a stash no yes

Three more defects surfaced while reading that dispatch, all in this PR:

 STOP_STDOUT_UNSUPPORTED_TOOLS
   codebuddy, workbuddy, codex
+  codex-internal, tcodex          same Codex, and they lost the hint entirely
+  matched case-insensitively      --tool Codex missed the set

 formatStopHookOutput
-  if (tool === 'codex') systemMessage   unreachable since it shipped

 votes nudge, recall rule declaration section
-  Chinese                               printed into the user's terminal
+  English

codex-internal and tcodex are supported targets whose hook command carries the raw id, so they missed the set, took the Stop path Codex rejects, and never reached the stash that would have recovered the hint. The systemMessage branch was added by the same commit that added codex to the set (09a2efd, #440), so every caller has gated it out since the day it shipped. CODEX_TOOL_IDS now lives in utils/tool-names.ts, and both the Stop gate and the hook-format detector read it, so a future variant is added once.

Evidence

The repro from the issue, run against the built CLI. It seeds a session with friction and reads the field Claude Code renders.

Before (installed 0.24.0, and origin/main):

$ bash loop.sh "$(which teamai)" claude
{"hookSpecificOutput":{"hookEventName":"Stop","additionalContext":"Print the following message verbatim to the user (do NOT paraphrase, summarize, or explain its origin):\n\n[teamai] This session may contain a problem worth documenting: ...
field                 : hookSpecificOutput.additionalContext
host shows it to user : True
carries model order   : True
RED

After:

$ bash loop.sh "node dist/index.js" claude
{"hookSpecificOutput":{"hookEventName":"Stop","additionalContext":"[teamai] This session may contain a problem worth documenting: the AI retried failing tools 6 times.\n\nTask: ...
carries model order   : False
GREEN

The Codex variants, before and after, through the same binary:

              before                                   after
codex         stashed, delivered next prompt           unchanged
codex-internal Stop payload Codex rejects, hint lost   stop stdout '' | stashed yes | relay order yes | delivered
tcodex         Stop payload Codex rejects, hint lost   stop stdout '' | stashed yes | relay order yes | delivered
cursor        followup_message, relayed                unchanged

The regression test is red on the original bug. Restoring the prefix in buildHint and rerunning:

$ npx vitest run src/__tests__/codex-stop-hint.test.ts
 × asks the model to relay the stashed copy, and never the copy Claude Code prints
  Tests  1 failed | 147 passed

Test Plan

Every item ran on this branch and passed. Host: macOS, SHELL=/bin/zsh.

  • npx tsc --noEmit clean
  • npm run build ok
  • npx vitest run 268 files, 3791 passed, 1 skipped, 0 failed
  • npm run test:e2e 42 files, 172 passed, 26 skipped
  • Real CLI, delivery verified end to end: CodeBuddy, Claude, Codex, cursor, codex-internal, tcodex
  • Real CLI, delivery shown not to happen, before or after: OpenCode (see below — this corrects an earlier claim in this description)
  • CodeBuddy's stashed UserPromptSubmit delivery diffed byte-for-byte against a dist/ rebuilt from origin/main sources: identical
  • Mutation check: reintroducing the prefix in buildHint turns codex-stop-hint.test.ts red and double-prefixes CodeBuddy's stash
  • Added tests for relayWhenHidden, stopStdoutUnsupported, the stash carrying the order while the printed copy does not, the Codex variants stashing, the nudge and rule section being English, and OpenCode's discarded stdout

Real-CLI record

Every row is the built CLI driven through the installed hook entry point,
node dist/index.js hook-dispatch <event> --tool <id>, with an isolated HOME
per tool, seeded with a high-friction session (50 tool calls / 7 unique tools,
then a Stop carrying 2 interrupts and 8 tool errors). "order" is the
Print the following message verbatim to the user line.

agent Stop stdout field order in Stop stashed order in stash next-prompt field reaches user
CodeBuddy (empty) — yes yes UserPromptSubmit.additionalContext yes
Claude Stop.additionalContext no no — — yes
Codex (empty) — yes yes UserPromptSubmit.additionalContext yes
OpenCode Stop.additionalContext no no — — no — host discards it
cursor followup_message yes no — — yes
codex-internal (empty) — yes yes UserPromptSubmit.additionalContext yes
tcodex (empty) — yes yes UserPromptSubmit.additionalContext yes

CodeBuddy — unchanged. This is the shared stashed UserPromptSubmit path the
review flagged. dist/ was rebuilt from origin/main sources in the same
worktree and the captured run diffed against the branch:

$ diff before-codebuddy.txt after-codebuddy.txt && echo IDENTICAL
IDENTICAL

Same field, same single relay order, same delivery on the next prompt. The order
moved from buildHint to the stash write, and for CodeBuddy those are the same
byte.

OpenCode — correcting an earlier claim in this description. An earlier
revision said the hint "reaches the user" on OpenCode. That was wrong, and the
review was right to block it. The generated plugin spawns the dispatch with
stdout discarded:

// src/opencode-hooks.ts — buildPluginSource()
const child = spawn('teamai', args, {
  stdio: ['pipe', 'ignore', 'ignore'],
});

and the generated file says so itself: "OpenCode cannot inject a hook's stdout
back into the session, so this runs the dispatch purely for its side effects."

So on OpenCode the hint reaches neither the user nor the model, on origin/main
and on this branch alike. Adding opencode to STOP_STDOUT_UNSUPPORTED_TOOLS
would not help either: the UserPromptSubmit payload the stash is delivered
through goes out of the same ignored stdout. My table row came from driving
hook-dispatch directly, which never goes through the adapter — that was the
hole in the record, and this row now states the adapter's behaviour instead.

That gap predates #719 and is a missing delivery path, not a double-delivery
bug, so it is not fixed here. What this PR does about it: hostShowsStopPayload
no longer implies OpenCode displays anything, and opencode-hooks.test.ts pins
the discarded stdout so the next change that starts relying on it has to come
through the test rather than repeat the claim. It needs its own issue.

Review points addressed

  • CODEX_TOOL_IDS moved from resources/agent-format.ts to utils/tool-names.ts.
    hook-handlers.ts imports tool-names.ts statically on every dispatch, and the
    old placement made that leaf utility depend on a module pulling yaml,
    gray-matter, smol-toml and builtin-hooks. ToolName is now a type-only import,
    erased at runtime. Measured honestly: those three packages are already at the
    top level of the bundle through another path, and hook-dispatch stop timed at
    a 141 ms median before and 140 ms after (n=12), so this buys module hygiene and
    a dependency that points the right way, not a measurable latency win.

One pre-existing flake, in a file this branch does not touch

local-agent.test.ts > emits hint only once per sessionId: ~2 of 3 full-suite
runs, 0 of 8 runs of that file alone. It does not appear in
git diff origin/main...HEAD --name-only. Cause not pinned; it needs its own
issue. The run recorded above is green.

Provider matrix: not applicable. This PR changes hook output shape and tool-id matching, and touches no clone, auth or provider path.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Related Issues

Closes #719.

Merge Danger

Door: two-way.

Nothing is deleted from a user's machine and no state migrates. Reverting restores the previous strings on the next release, and the only durable artifact is pendingHint in ~/.teamai/sessions/*.json, which is consumed on the next prompt and rewritten every session.

Blast Radius: the reminder text every member reads at the end of a session.

Three things a reviewer should weigh. The nudge wording changes for everyone, which is the point, but it is the most visible string the CLI prints. Cursor now receives the relay order from a different place in the code, so a Cursor user is the one to check if the reminder stops arriving. And the recall rule in src/builtin-rules.ts is now English in its declaration section and Chinese elsewhere: that split was chosen deliberately, because translating the whole rule changes deployed content for every team with recall on and belongs in its own PR.

Notes for Reviewers

src/builtin-rules.ts is the file to look at first if the mixed language bothers you. The alternative was translating all 51 lines of TEAMAI_RECALL_RULE_CONTENT, which lands in every agent directory on the next pull.

The <!-- teamai:referenced-doc-ids: ... --> marker is written by three producers (hook-handlers.ts, builtin-rules.ts, pull.ts) and read by one parser (transcript-parser.ts). That split predates this PR, which only translates two of the producers, so extracting a shared constant is left out rather than smuggled in. It is the obvious next cleanup if the marker ever changes.

teamai-wiki is still never pruned from machines that came from 0.13.0 or 0.16.x, and the other two private CODEX_TOOLS copies in coauthor-reconcile.ts and mcp-format.ts were left alone because they are not hook-delivery paths. Both are follow-ups rather than omissions.

@jeff-r2026 jeff-r2026 self-assigned this Sep 22, 2026
@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Required verification is incomplete. The PR marks npx vitest run complete despite reporting three failures, and the real-CLI record omits required CodeBuddy and OpenCode coverage. This is especially relevant because the shared stashed UserPromptSubmit delivery path changed. Per AGENTS.md, every Test Plan item must pass and the required agent matrix must be exercised before merge.

No additional code defects found from the diff-only review.

Closes Tencent#719.

Claude Code prints the Stop payload as "Stop hook feedback". The payload
opened with "Print the following message verbatim to the user", so the
user read the order, then read the message again from the model. The
reminder documented in docs/usage-guide.md carries no such line.

- buildHint returns the message. The relay order is added only where the
  host hides the payload: Cursor's followup_message and the stash that
  UserPromptSubmit delivers.
- The stashed hint runs last in the combined payload, so "the following"
  has an end. The votes nudge instructs the model and is not relayed.
- codex-internal and tcodex join STOP_STDOUT_UNSUPPORTED_TOOLS. They run
  the same Codex, which rejects Stop additionalContext, so their users
  lost the hint with no stash to recover it.
- formatStopHookOutput loses the codex systemMessage branch. Every caller
  checks the set first, so nothing has reached it since it shipped.
- The votes nudge and the recall rule's declaration section are English,
  matching the wording compileRecallRulesBlock already ships.
Review findings on the previous commit.

- formatStopHookOutput is shape only again. relayWhenHidden decides whether
  a message addressed to the user needs the model to pass it on, and the
  contribute hint is the only caller. Wrapping the channel also wrapped the
  recall declaration nudge, which instructs the model and would have been
  read out to Cursor users as terminal noise.
- stopStdoutUnsupported lowercases the tool id. Removing the codex branch
  took the only toLowerCase with it, so `--tool Codex` would have taken the
  Stop path Codex rejects.
- CODEX_TOOL_IDS lives in agent-format beside ToolName, and the Stop gate
  and the hook-format detector both read it, so a new variant is added once.
- The votes nudge test moves to hook-handlers, where the function lives.
  The formatter test no longer claims to guard Tencent#719; relayWhenHidden and
  the stash test do, and reintroducing the bug turns the stash test red.
@SaulMoro
SaulMoro force-pushed the fix/719-stop-hook-relay branch from 4cdccc1 to cbb7940 Compare September 22, 2026 10:32
@SaulMoro

Copy link
Copy Markdown
Collaborator Author

Rebased onto origin/main (was conflicting in src/__tests__/hook-handlers.test.ts — two independent appended describe blocks, both kept). Both halves of the P1 finding are addressed below.

1. npx vitest run was not green

The three shell-profile.test.ts failures were not "Windows cases that cannot pass on macOS". They were a host-environment leak in a test this PR does not touch:

detectShellProfile(platform)
  if (SHELL contains 'zsh') return ~/.zshrc      <- short-circuits first
  if (platform === 'win32') <login-shell file order>

The three win32 login-shell cases never stubbed SHELL, so they read the developer's. On CI (SHELL unset) they pass; on any zsh machine the short-circuit returns .zshrc and they fail. Proof, on this branch before the fix:

$ npx vitest run src/__tests__/shell-profile.test.ts
Tests  3 failed | 22 passed

$ env -u SHELL npx vitest run src/__tests__/shell-profile.test.ts
Tests  25 passed

Fixed test-only in its own commit (test(shell-profile): neutralise the host SHELL...): one vi.stubEnv('SHELL', '') in the file's existing beforeEach. detectShellProfile is unchanged. It is a drive-by, kept as a separate commit so it can be dropped if you would rather it went to its own PR — but leaving it means this suite stays red for every zsh contributor while passing CI.

Full suite now:

$ npx tsc --noEmit          # clean
$ npx vitest run
Test Files  268 passed (268)
     Tests  3789 passed | 1 skipped (3790)
$ npm run test:e2e
Test Files  39 passed | 3 skipped (42)
     Tests  172 passed | 26 skipped (198)
$ npm run build             # ok

One pre-existing flake remains, and I am not fixing it here. local-agent.test.ts > emits hint only once per sessionId fails on roughly 2 of 3 full-suite runs and 0 of 8 runs of that file alone. git diff origin/main...HEAD --name-only lists neither src/local-agent.ts nor src/__tests__/local-agent.test.ts, so nothing in this branch reaches it. emitBindingHint dedups through a marker at os.tmpdir()/teamai-bind-hint-<sessionId>, shared across workers, which is the obvious suspect — but I did not pin the cause, so I am reporting it rather than guessing at a fix. It deserves its own issue.

2. Missing CodeBuddy and OpenCode real-CLI record

Added. Every row below is the real built CLI (node dist/index.js hook-dispatch <event> --tool <id>), one isolated HOME per tool, seeded with a high-friction session (50 tool calls / 7 unique tools, then a Stop carrying 2 interrupts and 8 tool errors). "order" is the Print the following message verbatim to the user line.

tool Stop stdout field hint in Stop order in Stop stashed order in stash next-prompt field hint delivered
claude Stop.additionalContext yes no no — — yes
opencode Stop.additionalContext yes no no — — yes
cursor followup_message yes yes no — — yes
codebuddy (empty) — — yes yes UserPromptSubmit.additionalContext yes
codex (empty) — — yes yes UserPromptSubmit.additionalContext yes
codex-internal (empty) — — yes yes UserPromptSubmit.additionalContext yes
tcodex (empty) — — yes yes UserPromptSubmit.additionalContext yes

The shared stashed UserPromptSubmit path, which is what you flagged

CodeBuddy is unchanged. I rebuilt dist/ from origin/main's sources in this same worktree and diffed the captured run against the rebuilt branch:

$ diff before-codebuddy.txt after-codebuddy.txt && echo IDENTICAL
IDENTICAL

Same field, same single relay order, same delivery on the next prompt. The order moved from buildHint to the stash write, and for CodeBuddy those are the same byte.

OpenCode is the fix. Before (built from origin/main sources) and after:

                before                              after
opencode        Stop.additionalContext              Stop.additionalContext
                carries order   : True              carries order   : False
                → user reads the order, then the    → user reads the message once
                  same message again from the model

Text the OpenCode user now reads, verbatim from the payload:

[teamai] This session may contain a problem worth documenting: you interrupted the AI twice, the AI retried failing tools 8 times.

Task: Fix the auth retry loop then add regression coverage

Consider running /teamai-share-learnings to summarize what you learned and share it with your team.

CodeBuddy's next-prompt payload keeps the order, because its host shows the user nothing:

Print the following message verbatim to the user (do NOT paraphrase, summarize, or explain its origin):

[teamai] This session may contain a problem worth documenting: you interrupted the AI twice, the AI retried failing tools 8 times.
...

Mutation check

Restoring the prefix in buildHint and rebuilding turns OpenCode's Stop payload back to carries order : True, and double-prefixes CodeBuddy's stash — the two symptoms the split was meant to separate.

The Test Plan in the description has been rewritten to match all of the above.

@github-actions

Copy link
Copy Markdown

@SaulMoro
SaulMoro force-pushed the fix/719-stop-hook-relay branch from cbb7940 to 7af3b52 Compare September 22, 2026 10:48
@github-actions

Copy link
Copy Markdown

Findings

  • [P1 blocking] src/utils/hook-output.ts:15 classifies OpenCode as displaying Stop output, but src/opencode-hooks.ts:110 explicitly discards stdout. Therefore the PR’s “hint reaches user” claim for OpenCode is false. The described “real-CLI” test only invokes hook-dispatch directly and does not exercise the OpenCode adapter, so the required OpenCode end-to-end record is missing. Either implement a viable OpenCode delivery path or provide an actual host-level E2E proving delivery.
  • [P2 non-blocking] src/utils/tool-names.ts:1 imports a three-element ID constant from the heavyweight agent-format module, pulling YAML, TOML, gray-matter, and built-in-hook dependencies into every hook dispatch through the static normalizeToolName import. Keep shared tool IDs in a lightweight constants/tool-name module to avoid unnecessary cold-start work on the latency-sensitive hook path.

Per instruction, I reviewed the diff only and did not run tests or builds.

… deterministic

The three win32 login-shell fallback cases never stubbed SHELL, so they read
the host's. detectShellProfile short-circuits to .zshrc when SHELL says zsh,
which means these passed on CI (SHELL unset) and failed on every zsh developer
machine. Test-only; detectShellProfile is unchanged.
…'s discarded stdout

Review of Tencent#720 raised two points, both correct.

CODEX_TOOL_IDS lived in resources/agent-format.ts, so utils/tool-names.ts — a
leaf utility that hook-handlers.ts imports statically on every dispatch — took a
dependency on a module that pulls yaml, gray-matter, smol-toml and builtin-hooks.
The constant moves to tool-names.ts and ToolName comes back as a type-only
import, which is erased. hooks.ts and agent-format.ts read it from there.

hostShowsStopPayload classified OpenCode as a host that displays the Stop
payload. OpenCode's plugin spawns hook-dispatch with stdout ignored, so no
payload reaches the session on any event. The classification is inert either way
for OpenCode, but the comment said otherwise; it now names the gap, and
opencode-hooks.test.ts pins the constraint so a future change that starts
relying on that stdout has to come through the test.
@SaulMoro

Copy link
Copy Markdown
Collaborator Author

Both new findings were right. The OpenCode one in particular — I claimed delivery I had not proven, and the claim was false. Details below, followed by the earlier rounds for anyone reading this cold.

New round

[P1] OpenCode delivery was claimed, not proven

You are correct on every part of it. buildPluginSource() spawns the dispatch with stdout discarded:

// src/opencode-hooks.ts
const child = spawn('teamai', args, {
  stdio: ['pipe', 'ignore', 'ignore'],
});

and the generated plugin says so in its own header: "OpenCode cannot inject a hook's stdout back into the session, so this runs the dispatch purely for its side effects." My record drove hook-dispatch directly, which never goes through the adapter, so it could not have caught this. That was the hole.

The consequence is worse than "the classification is wrong": on OpenCode the hint reaches neither the user nor the model, on origin/main and on this branch alike. Adding opencode to STOP_STDOUT_UNSUPPORTED_TOOLS would not rescue it either — the UserPromptSubmit payload the stash is delivered through goes out of the same ignored stdout.

opencode
  Stop            stdout -> /dev/null      (plugin: stdio ignore)
  UserPromptSubmit stdout -> /dev/null      (same dispatch helper)
  => no path back into the session at all

So there is no viable delivery path to implement inside #719's scope. #719 is "the nudge is printed twice"; OpenCode's is "the nudge is never printed", a missing delivery path that predates this PR and needs its own issue and its own design (the plugin would have to return context from chat.message, not spawn a side-effect process).

What this PR now does instead of claiming otherwise:

  • The table row for OpenCode reads "no — host discards it", and the description spells out why, with the code.
  • hostShowsStopPayload no longer reads as if OpenCode displays anything; its doc names the gap and says the answer is inert for OpenCode either way.
  • opencode-hooks.test.ts pins the discarded stdout, so a future change that starts relying on it has to come through that test rather than repeat my claim.

If you would rather this PR not touch OpenCode's classification at all until that issue exists, say so and I will drop the comment and the test and leave only the corrected description.

[P2] CODEX_TOOL_IDS dragging a heavyweight module onto the hook path

Fixed, and it was a regression this PR introduced. hook-handlers.ts imports utils/tool-names.ts statically on every dispatch, and I had made that leaf utility depend on resources/agent-format.ts:

-utils/tool-names.ts  ->  resources/agent-format.ts  ->  yaml, gray-matter, smol-toml, builtin-hooks
+utils/tool-names.ts  ->  (type-only ToolName, erased)
+resources/agent-format.ts, hooks.ts  ->  utils/tool-names.ts

CODEX_TOOL_IDS now lives in utils/tool-names.ts and ToolName comes back as import type, erased at runtime.

One correction to the premise, measured rather than assumed: those three packages are already at the top level of the built bundle through another path, and hook-dispatch stop times the same either way.

before   heavy packages at top level: ['yaml', 'gray-matter', 'smol-toml']
         hook-dispatch stop: median 141 ms, min 131 ms (n=12)
after    heavy packages at top level: ['yaml', 'gray-matter', 'smol-toml']
         hook-dispatch stop: median 140 ms, min 134 ms (n=12)

So the change buys module hygiene and a dependency pointing the right way, not a latency win. Worth making, not worth claiming more than that.

Earlier rounds, for context

Round 1 — [P1] verification incomplete. Two parts.

npx vitest run was red. The three shell-profile.test.ts failures were not "Windows cases that cannot pass on macOS". The three win32 login-shell cases never stubbed SHELL, and detectShellProfile short-circuits to .zshrc when SHELL says zsh, so they passed wherever SHELL is unset and failed on every zsh machine:

$ npx vitest run src/__tests__/shell-profile.test.ts        -> 3 failed | 22 passed
$ env -u SHELL npx vitest run src/__tests__/shell-profile.test.ts -> 25 passed

One vi.stubEnv('SHELL', '') in the file's existing beforeEach; detectShellProfile untouched.

CodeBuddy and OpenCode missing from the real-CLI record. Added, and the record now lives in the description rather than in a comment.

Round 2 — [P2] the SHELL cleanup is unrelated, submit it separately. I pulled it out, then put it back at the author's call. The reasoning: without it npx vitest run is red on any zsh developer machine while green in CI, which is exactly the "Test Plan claims green but is not" problem that blocked round 1. It is one line in one test file, in its own commit, trivially droppable if you still disagree.

Current state

$ npx tsc --noEmit                                    # clean
$ npm run build                                       # ok
$ npx vitest run   268 files, 3791 passed, 1 skipped, 0 failed
$ npm run test:e2e  42 files, 172 passed, 26 skipped

Green on macOS with SHELL=/bin/zsh, no env -u SHELL needed.

One pre-existing flake stays reported and unfixed: local-agent.test.ts > emits hint only once per sessionId, ~2 of 3 full-suite runs, 0 of 8 runs of that file alone, absent from git diff origin/main...HEAD --name-only. Cause not pinned, so I am not guessing at a fix. It needs its own issue.

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Remove the unrelated shell-profile test change — src/__tests__/shell-profile.test.ts:29 modifies test environment handling for an independent Windows-shell flake. It does not trace to the Stop-hook delivery fixes and violates the repository’s surgical-change rule; move it to a separate PR.

The PR description includes a detailed test plan and real-CLI end-to-end verification record, so no testing-description blocker.

@SaulMoro

Copy link
Copy Markdown
Collaborator Author

On the remaining [P2]: you are right that it does not trace to #719. I kept it because removing it re-opens the [P1] that blocked this PR in round 1.

Round 1 blocked on the Test Plan claiming green while npx vitest run was red. The red was shell-profile.test.ts, and not for a Windows reason:

$ npx vitest run src/__tests__/shell-profile.test.ts         -> 3 failed | 22 passed
$ env -u SHELL npx vitest run src/__tests__/shell-profile.test.ts  -> 25 passed

Three win32 cases never stub SHELL, and detectShellProfile short-circuits to .zshrc when SHELL says zsh. Green wherever SHELL is unset, red on every zsh machine — CI included in the first group, the author in the second.

So without the commit there are only two outcomes, and both cost more than the rule they would satisfy:

  • Declare npx vitest run red in the Test Plan, which is exactly the round-1 blocker.
  • Or make this PR wait on a second PR being merged first — a hard dependency created by a non-blocking finding.

It is one vi.stubEnv('SHELL', '') in a beforeEach that already exists, detectShellProfile untouched, in its own commit (aee2bd4). If you still want it out, git rebase --onto 7af3b52 aee2bd4 drops it cleanly and I will restate the Test Plan as red-on-zsh — say the word and I will do it.

@jeff-r2026
jeff-r2026 merged commit cd3e0e6 into Tencent:main Sep 22, 2026
10 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
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.

[bug] Stop hook nudge reaches the user twice: the rendered payload tells the model to print it again

2 participants