Skip to content

fix(recall): honor recall switch in hook handlers - #1797

Closed
XY-code1 wants to merge 3 commits into
Tencent:mainfrom
XY-code1:fix/1788-recall-hook-switch
Closed

XY-code1 wants to merge 3 commits into
Tencent:mainfrom
XY-code1:fix/1788-recall-hook-switch

Conversation

@XY-code1

@XY-code1 XY-code1 commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Make the recall-attribution, votes-sync, and votes-push hook handlers use the existing effective recall switch instead of checking only TEAMAI_RECALL_DISABLED. This keeps the environment kill switch highest priority, lets the member override the team setting, and prevents recall evidence or vote work while recall is off.

The PR also documents the runtime behavior in the English and Chinese hook, reporting, settings, and recall guides, plus the setup skill and changelog.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes (npm run typecheck)
  • npm run lint passes (including scripts/check-docs.mjs)
  • The focused hook tests pass: npx vitest run src/__tests__/hook-handlers.test.ts -t "recall|votes-sync|votes-push" (20 passed)
  • Added/updated tests for member off, inherited team off/on, environment override, and all three handlers' no-side-effect path

Built-CLI verification on Windows, using an isolated user config and a real git-backed team repo:

  1. Team sharing.recall.enabled: true, member recallEnabled: false.
  2. teamai recall status printed Recall: disabled and identified the member override.
  3. A built hook-dispatch stop --tool claude event with TEAMAI_ADOPTION_EVAL_LOG set left no log (OFF_LOG_EXISTS=False).
  4. teamai recall enable, followed by the next identical event, wrote one reducer record: {"sessionId":"on-session","recalled":0,"adopted":0} (ON_LOG_EXISTS=True).

Interleaved built-CLI timing (20 runs per state, 0.6 s pause, Windows host): enabled median 1501.5 ms; disabled median 1500.7 ms. This slice removes background work rather than foreground wait, so the result shows no hook-latency regression as expected.

I also ran the whole hook-handlers.test.ts file locally: 153 passed, 1 skipped, and two existing Windows/environment-sensitive assertions failed outside this change (detached-process option capture and an invalid-path contribute-check case). The focused changed tests, typecheck, lint, docs check, and build all pass.

Related Issues

Slice 5 of #1788

Notes for Reviewers

hookRecallEnabled intentionally loads the team config at event time. Nothing is installed or removed, so teamai recall disable / enable affects the next hook event. Existing handler work stays unchanged after the gate.

AI disclosure: developed with Codex assistance; I reviewed the changes and ran the verification above.

@XY-code1

XY-code1 commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed the CI regressions in ce92c28. The new recall gate correctly defaults legacy fixtures to disabled, so the existing attribution/vote/scope tests now explicitly enable recall in both local and team configuration before exercising recall-dependent hook behavior. This covers user scope, project scope, and dispatcher-resolved fallback scope.\n\nValidation:\n- typecheck passed\n- type-aware oxlint passed for the changed tests\n- all PR checks now pass, including Node 20/22/24 Linux, both macOS shards, Windows, coverage, and all E2E shards

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

No confident findings in the specified PR diff.

The PR description documents sufficient testing: focused tests, typecheck, lint, build, and a representative built-CLI verification showing recall-off produces no reducer log and recall-on resumes recording. This satisfies the real-CLI requirement; no additional provider/agent matrix is required.

Review was read-only. I did not run, build, or install anything from the PR.

@SaulMoro

SaulMoro commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Thanks for this. The gate code itself checks out. With a built CLI, a member who turned recall off no longer records attribution or votes (main still does), and a team with recall on behaves as before. The CI review found nothing in the code, and I agree.

Two things stop me from approving it as it stands.

It is a breaking change. Recall is off by default, so a team that never set sharing.recall.enabled stops recording attribution and votes. On main, a teamai hook-dispatch stop event writes the votes-sync line for that team. At this head it writes nothing:

sharing.recall.enabled recallEnabled main this head
not set not set written not written
true not set written written
true false written not written

#1788 itself says this belongs in the changelog for that reason. Here it is filed under Bug Fixes, with no ! in the title.

#1801 contains the same change. Its commit d3add68c (feat(recall)!: let the recall switch stop the recall hooks) gates the same three handlers through isRecallEnabled, marks the change as breaking, and its CHANGELOG names the team that never enabled recall. The two branches also conflict in four guide pages. Rather than landing it twice, we'll take slice 5 through #1801 and close this one once that merges. If your tests for the member-off, team-on and environment-override cases cover something #1801's do not, say so and I'll make sure they carry over.

@SaulMoro

SaulMoro commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Closing as covered by #1801, now on main as 595c37d. Its d3add68c gates recall-attribution, votes-sync and votes-push on the same switch teamai recall status reads, as this PR did. The CHANGELOG lists it under Breaking Changes, naming the team that never turned recall on. Thanks for the work here. If one of your hook-handler cases, such as member off with the team on, or the environment override, is not covered on main, tell me and I'll make sure it gets added.

@SaulMoro SaulMoro closed this Nov 9, 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.

3 participants