Skip to content

[pull] main from Tencent:main - #11

Merged
pull[bot] merged 3 commits into
Walternater:mainfrom
Tencent:main
Aug 28, 2026
Merged

pull[bot] merged 3 commits into
Walternater:mainfrom
Tencent:main

Conversation

@pull

@pull pull Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

…358)

team-wiki-codebase failed to reach IDE skill dirs on fresh installs,
breaking the import AI-enrich flow. Two root causes:

1. It was gated behind RECALL_DEPENDENT_SKILLS, so with recall disabled
   (the default) it was silently skipped — but it is a knowledge-base
   generator that does not depend on recall. Removed it from the set;
   only teamai-share-learnings remains.
2. `teamai init` never deployed built-in skills at all (only `pull` did),
   so users had nothing in the IDE right after init. Added Step 7.5 to
   deploy built-in skills immediately, mirroring pull's proven path.

Tests: real-fs regression covering skipRecall deployment, and an init
call-site test.
The `import --dir` flow extracted code knowledge but stopped short of the
reconcile and deep-enrich stages that `--from-repo` runs, so local-directory
imports produced only shallow evidence without component design docs, the
architecture overview, or the AI graph docs (G5/G6).

Add the reconcile -> deep-enrich stages to both --dir sub-paths (--output and
the default team-repo push), mirroring the --from-repo pipeline, and factor the
shared logic into a `reconcileAndDeepEnrich` helper to avoid duplication. Deep
enrich still runs only when AI enrichment produced a _manifest.json and
--skip-enrich is not set; both stages remain non-blocking.
…graph (#304)

* feat(wiki-engine): add WASM tree-sitter AST track for code knowledge graph

The code knowledge graph extractors were purely regex/line-based, which
produced false-positive dependency edges (path-substring matching) and had
no notion of call relationships. This adds a real AST track using
web-tree-sitter (pure-WASM, no native toolchain) for TypeScript/JavaScript,
Python, and Go, ported from the team-wiki reference implementation.

- New ast/ module: WASM parser registry (async one-time init), tree-sitter
  queries, symbol/import/call-site walk, import & call resolvers, and
  fact/edge adapters. Emits precise file-to-file DEPENDS_ON / REFERENCES
  edges tagged source:"code-ast" with confidence weights.
- Dual-track: runs alongside the regex heuristic track (which still covers
  Java/Rust/config); AST facts win on merge. Falls back to heuristic-only
  and records an AST_UNAVAILABLE gap when the runtime is unavailable or
  TEAMAI_SKIP_AST=1.
- code-graph: AST relation facts build precise edges instead of being
  re-fuzzed through the path-substring matcher.
- enrich: manifest edges now preserve real AST relation/source provenance
  (deterministic rank-based merge) instead of hardcoding DEPENDS_ON /
  code-heuristic.
- Pinned [email protected] + [email protected] (only ABI-14
  compatible pair; 0.26 rejects these grammars).
- Docs (README + usage-guide, EN/zh-CN) and unit tests added.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(wiki-engine): address AST track code-review findings

- walk.ts: free the parsed tree-sitter Tree via try/finally { tree.delete() }
  to release WASM off-heap memory; JS GC does not reclaim it, so large repos
  would otherwise grow the emscripten heap unbounded.
- call-resolver.ts: memoize import bindings per source file in resolveCallSites
  (was rebuilt for every call site — O(callSites × imports)).
- import-bindings.ts: detect Python exports via module-level class/function
  definitions instead of the non-existent "__export__" node type, so Python
  symbol-level call resolution works (was always exported=false).
- merge-edges.ts / import-resolver.ts: drop unused findConflictingEdges,
  EdgeConflict, and clearTsconfigCache (speculative dead code).
- walk.ts: simplify a no-op ternary on the call receiver.
- tests: add a Python module-level-export regression case.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* feat(wiki-engine): resolve Python dotted imports and TS implements edges

Two AST-resolver precision improvements from PR review follow-up:

- Python multi-segment imports: `from a.b.c import x` now maps the dotted
  module to a nested path (a/b/c.py or a/b/c/__init__.py) instead of only
  resolving single-segment sibling imports.
- TS/TSX IMPLEMENTS edges: a class's `implements` clause now produces
  IMPLEMENTS edges (source:"code-ast") to the interface's defining file,
  resolved via same-file interface symbols or imported bindings. A separate
  query pattern avoids the capture-map collision when a class implements
  multiple interfaces; names that resolve to neither (ambient/global types)
  are skipped rather than emitting a spurious edge.

Adds tests for both; Go cross-package module resolution remains a known
follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs: mention IMPLEMENTS edges in AST track description

Keep README and usage-guide (EN/zh-CN) in sync with the new TS implements
edge support.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(import): serialize team-repo write phase to stop batch races dropping AST edges

Batch imports (--from-repo-list and --from-org, which run importFromRepo
concurrently at concurrency>=2) were losing AST edges: the final per-repo
graph-index.json committed to the team repo contained only code-heuristic
edges, while single --from-repo and concurrency=1 produced the correct
code-ast edges.

Root cause: each concurrent importFromRepo writes into the shared
teamwikiRoot (per-repo graph copy, facts/interfaces caches, source-manifest,
router/index, and reconcileKnowledge's global graph). Those are
read-modify-write operations on shared files, so parallel repos clobbered
each other's artifacts.

Fix: a module-level promise-chain mutex. The clone + extractCodebase phase
(the expensive part, which writes only to the per-repo cache dir) stays
parallel; only the team-repo write phase is serialized. A repo acquires the
lock after extract and releases it in the existing finally, so it is
exception-safe and never deadlocks. Verified: with the fix, concurrency=3
batch import produces the same code-ast edge counts as concurrency=1.

Adds unit tests asserting the mutex's mutual-exclusion, re-acquire, and FIFO
contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Revert "fix(import): serialize team-repo write phase to stop batch races dropping AST edges"

This reverts commit f798f21.

* feat(import): add cross-process lock to protect uncommitted artifacts

During import, teamwiki artifacts sit uncommitted in the team-repo
working tree until the final aggregate+push. An ambient teamai hook
(SessionStart -> reportUsageToTeam) runs `git reset --hard HEAD` on that
same repo, wiping those artifacts before they are committed.

Add a cross-process file lock (import-lock.ts): the lock file lives in
the team-repo's PARENT dir so it is never reset away. It carries pid +
host + startedAt, with a 2h TTL, same-host PID liveness probe, and
dead-lock self-cleanup. Reference-counted for reentrant single/batch use.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(import): hold import lock and skip hook reset during import

Wire the cross-process lock into the import paths and honor it in the
reset path:

- reportUsageToTeam: before resetToCleanMaster, check isImportInProgress
  and skip reset+pull when an import holds the lock.
- importFromRepo: acquire the lock around the whole artifact-write phase
  (steps 4-7), release in finally.
- importFromRepoList: hold one outer batch lock across the whole run so
  per-repo skipAutoPush artifacts survive until the final push.

Add deep-enrich-graph-preserve regression test proving deepEnrich never
mutates the per-repo graph-index.json.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(wiki-engine): resolve Python absolute package imports in AST track

The AST import resolver only handled relative and sibling-module imports (based on the importing file directory). Python code importing via the top-level package name rooted at the repo root (e.g. from hai_flow.conf import config) failed to resolve, leaving the import-binding table empty. Since cross-file call edges are built from those bindings, a large pure-Python repo produced zero code-ast edges despite hundreds of resolved calls. Add resolveAbsolutePackageImport: map a dotted specifier onto a repo-root-relative path and probe for a module file or package __init__.py. On a real 669-file Python repo this took the graph from 0 code-ast edges to 948.
@pull pull Bot locked and limited conversation to collaborators Aug 28, 2026
@pull pull Bot added the ⤵️ pull label Aug 28, 2026
@pull
pull Bot merged commit 6e29f84 into Walternater:main Aug 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant