#182·pua

Bug: Ding Inside/Outside chapters injected for non-ding flavors + frustration trigger self-loop

Author: GH66688Created Jul 14, 2026Updated Sep 10, 2026

Summary

Two related issues in the session-restore and frustration-trigger hooks:

1. session-restore.sh injects Ding chapters regardless of flavor

The Always-On protocol template in hooks/session-restore.sh hardcodes the entire "钉内/钉外提醒模式" section (9 sub-sections: 发心/手感/温室/每日一包/望舒/口径/钉外/人与柴火/已读恐怖主义 + 8 example blockquotes + ~2000 Chinese characters). This content is injected for EVERY flavor (alibaba, bytedance, huawei, etc.), not just ding.

Expected: Ding chapters should only be injected when flavor == "ding". For other flavors this is pure noise that dilutes useful context.

Fix: Move the Ding section into a if [ "$PUA_FLAVOR" = "ding" ] conditional block after the main protocol template.

2. frustration-trigger.sh regex contains self-trigger keywords

The TRIGGER_RE regex includes 置身钉内|置身钉外. When the AI (responding to an earlier trigger) uses these terms in its reply, and the user then asks "why did you say 置身钉内?", the user's message matches the regex → the hook fires again → injects PUA_SKILL_CONTEXT again → creates a self-reinforcing loop.

Additionally, there is no guard against repeated injection within the same session.

Fix:

  • Remove 置身钉内|置身钉外 from TRIGGER_RE (these are meta-terms describing the plugin itself, not user frustration signals)
  • Add a session-level fired-marker (/tmp/pua-frustration-fired-$PPID) to prevent re-injection in the same session

Impact

  • Context bloat: ~2000 chars of noise per session on non-ding flavors
  • Self-trigger loop: multi-round context amplification when discussing the plugin behavior
  • On a real user session, this contributed to 2.27M tokens spent diagnosing a simple bashrc timeout issue because the actual task signal was buried under repeated protocol injections

Environment

  • PUA v3.5.0
  • Claude Code
  • Config: {"always_on": true, "flavor": "alibaba"}