Codex/Copilot review on the v1.3.12 release PR (#103) found 1 P1
identity-state bug + 2 P2 hot-reload gaps + 5 polish issues. The
follow-up internal 5-agent audit on HEAD also surfaced 2 P1 security
issues (oauth.js token leak) plus several compliance/doc drifts.
Bundles all v1.3.12 capabilities (4 architectural root-cause fixes,
search_messages tool, CLI tool mode, displayLabel sender pack, etc.) —
recommend skipping v1.3.12 and upgrading straight to v1.3.13. See
CHANGELOG v1.3.13 section for the full picture.
### Security (P1)
- oauth.js: \`exchangeCode()\` previously logged the full raw response
body (containing access_token + refresh_token) to stderr on every
OAuth callback. Replaced with HTTP status + body length only;
\`saveToken()\` fallback now redacts token values to a
\`slice(0,6)…(N chars)\` preview instead of dumping verbatim.
### Functional fixes from Codex review
- src/auth/identity-state.js withIdentityFallback UAT-success path now
sets \`data._viaUser = true\`. Pre-v1.3.13, 15+ \`_asUserOrApp\` callers
in calendar/docs/bitable/wiki/okr/tasks/drive read \`res._viaUser\`
to label ownership — without the flag, every successful UAT-owned
write was reported as \`viaUser:false\` with no fallbackWarning.
- src/server.js main() now calls \`credMonitor.sync()\` once at startup
(after officialClient is built). Pre-v1.3.13 the first per-tool sync
always silently baselined the current file, swallowing any
oauth-refreshed credentials in the boot-to-first-tool-call window.
- src/server.js registers an \`onCookieChange\` hook that nulls the
userClient singleton. Pre-v1.3.13 the monitor detected
LARK_COOKIE changes but server.js never wired them — cookie-based
tools kept the stale LarkUserClient until restart.
- src/tools/im-read.js read_messages via_user=true now correctly
labels the response \`via:'user'\` (was bot+contacts_resolved_external
spurious reason).
- src/clients/official/base.js _populateSenderNames logs unresolved
ids (cached as null sentinel) — not just Promise.allSettled
rejections. getUserById/getAppName return null on non-zero codes
without rejecting, so the rejection log was missing the common case.
### Audit findings — compliance / docs
- CLAUDE.md: removed stale "未实现: search_messages" (already shipped
in v1.3.12); reconciled tool-class counts (Drive 5→4, added
cross-domain Uploads (3) row, plugin layer 4→3+2). Sums to 85.
- docs/REFACTOR-NOTES.md tools/ tree: added tasks.js (v1.3.7) and
events.js (v1.3.9) — both files existed but the tree skipped them.
Updated smoke contract "当前 84" → "当前 85".
- docs/TOOLS.md IM section: added search_messages name + description
to fill the previously hollow "16 tools" claim. Drive section split
into Drive (4) + Uploads (3) so the count matches src/tools/.
- docs/COMPARISON.md / CONTRIBUTING.md / .github/pull_request_template.md:
84 → 85 sweep. COMPARISON also bumped "最新 v1.3.11" → v1.3.12.
- CLIENT-COMPAT.md "5 客户端" → "7 客户端"; ✓ 84 → ✓ 85 across the
table; outdated .mcpb artifact name v1.3.11 → version-agnostic
placeholder.
- scripts/verify-app-name.js: interpolate \${appId} into the
remediation URL (was \`<appId>\` literal placeholder).
- src/test-lru-cache.js header comment fixed.
### CI / process
- .github/workflows/validate.yml: added \`node scripts/check-changelog.js\`
+ \`npm test\`. Pre-v1.3.13, the 14 fixture-based unit tests were
not in the PR gate — anything that broke them could still merge.
- src/test-all.js: wires \`test-lark-desktop\` (was orphan
standalone). \`test-lark-desktop.js\` adds module.exports = { run }.
### 4-source version bump
- package.json / .claude-plugin/plugin.json / .cursor-plugin/plugin.json
/ .mcpb/manifest.json / mcp-registry.json (top-level + packages[0])
/ SKILL.md / server.json (regenerated) — all aligned at 1.3.13.
All 10 CI gates verified green: check-version / check-tool-count /
check-scopes / check-description-drift / check-mcp-registry-version /
check-mcpb-version / sync-server-json check / check-docs-sync /
check-changelog / smoke (diff). gitleaks scan clean.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>