Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[bug] The index shrink guard blocks legitimate rebuilds, so recall returns resources the member no longer has

Closed Beginner friendly
#1,006 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #1019 by @SaulMoro — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
cli, search

Research direction

Start with guardIndexShrink in src/utils/search-index.ts and trace how the rebuild determines which files it was given versus how many it read. Adjust the guard to preserve the old index only for a partial read failure, then run the relevant search-index tests and verify that a legitimate rebuild to zero entries clears the stale index.

Written by the indexing model from the issue text.

Description

bug

Description

teamai pull rebuilds the search index from what this member receives (#707). When that set shrinks to under 20% of the old index, guardIndexShrink in src/utils/search-index.ts treats the rebuild as a read failure and keeps the old index:

⚠ Index rebuild skipped: new index (0) is <20% of existing (7), likely partial failure

Nothing clears it, pull --force included. Recall keeps returning skills, rules, and docs the member no longer has, and every pull prints the warning.

Normal use triggers it. A member leaves a project with teamai projects set, switches roles, or the team deletes most of its resources.

The index should follow what the member receives. The guard should keep the old index only when the build read fewer files than it was given, the failure the guard exists to catch.

#83 reported the same symptom for deleted docs. Its fix (#98) lowered the threshold from 50% to 20%, so a large legitimate shrink still sticks.

Reproduction

The team has a project app whose skills namespace ns holds 7 skills, zqx-skill-1 to zqx-skill-7.

  1. teamai init <team-url> --provider git --agent claude --scope project --project app
    teamai installs the 7 skills in .claude/skills/. The index holds 7 entries.
  2. teamai projects set
    No ids, so the member leaves every project.
  3. teamai pull
    Pull removes the 7 skills and prints the warning above. The index still holds 7 entries.
  4. teamai recall "zqx-skill-3"
    Recall returns [skills] zqx skill 3 from team-repo/skills/ns/zqx-skill-3/SKILL.md.

To work around it, delete ~/.teamai/projects/<project>/search-index.json, then run teamai pull.

Environment

  • OS: macOS (Darwin 27.0)
  • Node.js: v24.21.0
  • teamai: main at ec7d4db0
  • Provider: git
  • AI tool(s): Claude Code

Logs

Step 3, teamai pull
ℹ [project] Removed 7 skill(s) no longer delivered here: zqx-skill-1, zqx-skill-2, zqx-skill-3, zqx-skill-4, zqx-skill-5, zqx-skill-6, zqx-skill-7.
ℹ [project] No resources to sync
⚠ Index rebuild skipped: new index (0) is <20% of existing (7), likely partial failure
Dominant language
TypeScript
Stars
5.6k
Forks
471
Avg merge
20h 16m
Merged PRs (30d)
399

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Tencent/teamai-cli

All issues in Tencent/teamai-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.