Repository navigation
refactor(report): drop the unreachable clone-reset path in reportUsageToTeam (#1259) - #1293
Conversation
Signed-off-by: G-type <[email protected]>
Signed-off-by: ydflow <[email protected]>
Review limitation: The requested three-dot diff fails because the shallow checkout has no merge base, and network access is unavailable. I inspected the two PR commits’ diff, but cannot confirm it exactly matches the requested range. No additional confirmed code findings; the exact-range review remains incomplete. |
* feat(push): place all distributed resources with project and role namespaces (Tencent#1101) * fix(push): harden namespace routing and review (Tencent#1101) * fix(push): read manifests after pull and guard capture/restore paths Three CI failures rooted in the same family of pre-pull / path-confusion bugs introduced with the namespace placement work: 1. syncWorkflowDefinitions unconditionally resolved resource namespaces (reading projects.yaml and roles.yaml) from validateWorkflows, which runs BEFORE pushCore refreshes the clone. A stale manifest mapped new resources to the wrong namespace (Tencent#649 review). Now the manifest is only read when namespaced workflow candidates exist, wrapped in try/catch so an unreadable manifest degrades to on-disk namespaces. 2. resolveResourceNamespaces at the docs/wiki annotation site had no error handling: a manifest that exists but cannot be read produced an unhandled rejection instead of the graceful exitCode=2 stop every other manifest-error path uses. 3. The pre-pull snapshot capture was widened from env-only to every placeable type, but restorePendingEnvFiles writes to clone/<relativePath>. For project-local sources (tool-format agents, rules, skills) that wrote tool-format bytes over the clone's canonical files, so the next scan reported "cannot read or parse canonical agent YAML" and dropped rules entirely. Now only sources inside the team repo clone are captured — the ones resetToCleanMaster can destroy. * chore: trigger CI * chore: nudge CI trigger * fix(push): do not stage pre-placement paths as superseded files placeNewResources marked the pre-placement root path as supersedes when moving a new resource into a namespace. pushRepoBranch then staged that path with git add, but the root file was never in the clone, so git aborted with 'pathspec did not match any files'. supersedes is for pushItem retiring a tracked file during a format rename (agent .md to .yaml); a placement from the shared root to a namespace is not a rename. * fix: address review findings — binary copy, prompt namespaces, env placement, role learnings, wiki source, and P2s P1 fixes: - repo-resource: use fs.copyFile byte copy instead of UTF-8 text I/O to prevent binary doc corruption - workflow/cache: resolve prompt namespaces independently of workflow layout; support nested prompt paths - env: add status field to envPushItem so placement routes env/env.yaml to env/<ns>/env.yaml - roles: include learnings in role namespace resolution (Tencent#1101: 'Learnings should support --project and --role') - wiki: point handler at teamwiki/evidence/code/ (authoritative source per manifest-schema.ts:112) - push: filter LOCAL_TOOL_TYPES from pre-refresh scan to suppress spurious warnings P2 fixes: - push-namespaces: add rootSegmentsFor() and withNamespace(rootSegments) for wiki's multi-segment root - review-branch: fix nested path identity collision (use full sub-path as name); preserve handler-provided names - review-branch: skip undeclared-namespace check in manifest-free teams - --role: warn when not declared in manifest/roles.yaml - status: count models/claudemd/learnings/wiki/workflows/prompts/scorers - push: simplify pushRepoResourceItem signature to LocalConfig only - docs: update distribution.md and --role/--project help text - push: tighten pre-refresh snapshot to only capture clone-backed items * fix: snapshot key mismatch and manifest-error namespace fallback - push: track prePlacementPath so the snapshot delete finds the entry keyed by the root path after placement rewrites item.relativePath - workflow/cache: a manifest that cannot be read now resolves to an empty namespace set (conservative) instead of falling back to 'every namespace active', which cached inactive workflows as runnable - commands.md: regenerate snapshot for updated --role/--project help text * fix: address second re-review — reuse-path snapshot, env copy, manifest-free prompts, nested names, rule names P1 fixes from re-review of d77e8f0: - push: reuseRecordedDestinations saves prePlacementPath before rewriting relativePath so the snapshot delete finds the root-path entry - env: pushItem copies file whenever source != destination (not just self mode), so env/env.yaml -> env/<ns>/env.yaml actually writes the file - workflow/cache: manifest-free teams discover prompt namespaces from disk so prompts/<ns>/deploy.md resolves for prompts/deploy.md - review-branch: parseRelativePath uses basename (not full sub-path) so nested names like 'api/guide' don't fail isSafeNamespaceSegment - rules: scanTeamForPull extracts name and namespace separately, so rules/ops/foo.md -> name 'foo', ns 'ops' instead of name 'ops/foo' P3: - workflow/cache: update stale comment about manifest-error fallback * fix: revert scanTeamForPull change, fix rule names in review-branch instead The rules.ts scanTeamForPull change (extracting name/namespace from the path) broke pull and uninstall behavior — CI failures in uninstall.test.ts and workspace-children.test.ts showed extra rules/fe/*.md globs and rules/platform/ops.md delivery. Revert rules.ts to its original form and instead handle the name/namespace extraction in review-branch.ts scanResources, where rules items now go through parseRelativePath like other non-handler-authoritative types. * fix(review): entry identities for hooks, wiki authoritative root, per-segment doc names - review-branch scans wiki at teamwiki/evidence/code (where the handler and pull read it) instead of wiki/, and READ_ROOTS materializes the same root, so wiki pages no longer bypass branch review - hooks are reviewed by their entry ids (pull's hooks reader identity), not by file name, so co-active hooks/a/hooks.yaml and hooks/b/hooks.yaml with disjoint ids are not duplicates; unreadable or entry-free files keep a file identity so naming and leak checks still see them - docs and wiki keep their bundle-relative sub-path as the resource name (below the namespace when declared, below the root otherwise), and namingFindings validates each path segment on its own, so shared nested docs like docs/api/guide.md pass review while co-active docs/a/api/guide.md and docs/b/ui/guide.md stay two resources - leakFindings checks a file once even when several resources share it - update the Chinese distribution guide to match the push behavior change * fix(review): nested prompts are shared paths, docs identities keep extensions - prompts join docs and wiki as nested types: a first directory is a namespace only when a manifest declares it, so a workflow's prompt_file: prompts/topic/note.md stays a shared prompt instead of failing review as an undeclared namespace 'topic' - docs/wiki/prompt identities keep the file extension, so docs/a/api/guide.md and docs/b/api/guide.png are distinct resources and no longer report a false duplicate - move the undeclared-namespace assertion onto workflows, which still treats its first directory as a namespace * fix(push): place nested prompts, and remember where a repo-backed placement landed - prompts join docs and wiki as nested types on the push side too: a first directory is a namespace only when a role or project declares it, so a new prompts/topic/note.md is shared content (isAtSharedRoot) that a placement still moves to prompts/<ns>/topic/note.md, the path a workflow resolves at runtime. resolveResourceNamespaces now reports the declared-but-inactive prompts namespaces that decision needs - remember where push placed a repo-backed resource (docs, wiki, prompts, workflows, scorers, models, env, hooks, claudemd, learnings) in state.placements, keyed by the path the author still edits, and record it only once the placement's blob is on the default branch (the same proof placedRules uses, so a PR closed unmerged leaves nothing behind) - a self-mode scan now compares that author copy against the destination instead of reading it as brand new: unchanged means already delivered, an edit is reported as that destination's modification, so the next push --all --role <ns> no longer collides with the file it placed * fix(push): reuse a placement record in env scans, and expire one whose file was deleted - EnvHandler's self-mode scan reads state.placements too: an env file an earlier push placed under env/<ns>/ is compared against that destination, so the unchanged .teamai/env/env.yaml is not new again (and does not collide with the file it produced), and an edit is reported on the placed path - a repo-backed placement record is dropped when its destination was deleted since the last checkpoint, even if the path exists again: what is there now is somebody else's, and following the record would route this author's edits onto it. Same rule and same checkpoint as placedRules/placedAgents, which now stays while any record — including these — survives - share namespaceOfPlacedPath in push-namespaces so both scans read the namespace a record's destination carries the same way * fix(push,workflow): retire a placed env original, keep explicit prompt namespaces - EnvHandler.pushItem retires the clone-local original once a placement has copied it, as pushRepoResourceItem does: a leftover untracked env/env.yaml was rediscovered as new by the next push, which then aborted because the placed env/<ns>/env.yaml already existed. A self-mode source lives in the active .teamai tree, outside the clone, and is kept — that is the copy the author still edits - resolvePromptFiles resolves a prompt_file whose first segment is already an active namespace as written: prompts/ops/note.md no longer looks up prompts/<other>/ops/note.md, which loaded a different file whenever both existed * test(push): use .md scorer names in the placement samples A scorer is scorers/<name>.md (frontmatter plus a prompt), and review --branch fails any other file under scorers/ but README.md (Tencent#1085), so the sample items name .md files rather than .py. * fix(push): compare a placed copy with what its push delivered A placement record held only the destination path, so the self-mode scan compared the author's root copy with the placed file as it is now. Once a teammate changed that file, an untouched copy read as an edit and was pushed over their change, with no warning. Keep the delivered blob with the record and compare the author's copy with it: equal is already delivered, different is the author's edit, which goes to the placed file unless that file changed too, in which case the scan stops and names the file to edit. An edit that lands refreshes the record. A record holding only the path, as earlier builds wrote, is dropped. * fix(push): judge a placed env file against what its push delivered The self-mode env scan compared an unchanged .teamai/env copy with the placed file as it is now. After a teammate fixed env/ops/env.yaml on the team repo, the author's old copy read as an edit and the next push carried it over the fix. Use the same placed-copy check as the other repo-backed scans, which compares against the blob the push delivered. * fix(push): require --role to name a declared namespace --role was taken as a literal namespace on every axis. In a team with manifest/roles.yaml or manifest/projects.yaml, a namespace no role or project declares for a type is one pull delivers to nobody, yet push wrote rules/<ns>/, docs/<ns>/, workflows/<ns>/ and the rest there after a warning that checked roles.yaml only. Resolve --role per type against the namespaces both manifests declare for that type's axis, the way --project resolves against its project, and stop with exit 2 otherwise. A team with neither manifest still takes any namespace. The push-role unit fixtures now declare the namespaces their tests pass. * fix(contribute): use the learnings namespaces of the member's roles Roles now declare learnings namespaces, and pull delivers learnings/<ns>/ to the role's members, but contribute still resolved learnings from active projects only. A role-only member's contribution went to the shared root, and --namespace rejected the role's own namespace. Resolve the active learnings namespaces from roles and projects, in the order pull merges them, in the one function contribute, recall, import and `projects list` read. * fix(push): let a scan error before the refresh reach the pull failure path The pre-refresh scan swallowed a handler's error and treated that type as having no changes, so the clone was refreshed without knowing what the type held. Let the error propagate to the same catch the env scan uses. * fix(push): say to merge a conflicting edit into the placed file The conflict message read as if the author's edit should replace the team's change in the placed file. Say the edit is merged into that file, keeping the team's change, before the shared-root copy is deleted. * docs(changelog): note the --role namespace check * feat(namespaces): resolve inactive scorers namespaces like prompts Pull has no scorers reader yet (Tencent#1085). Resolve the scorers namespaces a member does not select, in the same shape prompts use, so that reader can withhold them. * feat(contribute): accept an empty --namespace as the shared root A member whose roles or project declare one learnings namespace contributed there by default, and --namespace only accepted declared namespaces, so that member could not write to the shared root. A member with several namespaces reaches it by default. --namespace "" now names the shared root for every member. * test(push): push only the rule where --role names a knowledge namespace Five placement-record cases pushed a rule, a skill and an agent with --role be-know, which the roles manifest declares only for knowledge. Since --role has to name a declared namespace for each type it places, that push stops with exit 2. The cases are about rule records, so they push the rule alone. * test(push): keep a teammate's change from a self-mode checkout behind main Single-repo push compares the member's .teamai/ with a fresh origin/<default>, so on a checkout behind it a file a teammate changed reads as the member's edit and the branch carries the old content back. Cover a file only main changed, a file both changed, a namespaced destination, a format change that deletes a file main changed, a tool-directory copy edited on top of main, a shallow clone, a checkout with no shared history, and a stop for a file the push does not send. A genuine edit of a stale .teamai/rules copy now stops instead of overwriting the teammate's update. * fix(push): leave out team files main changed under a self-mode checkout behind it For each item sourced from .teamai/, compare the member's file with the merge-base and the tip of the default branch, at its source, its destination and any file the push deletes. A file only the default branch changed is left out with a line saying git pull brings it in. A file both sides changed, a file the push would delete, or one that cannot be classified for lack of shared history stops the push with exit 2 before anything is written, naming the files and the remedy. The stop applies only to items going out. Tool-directory copies keep their own checks: the pre-push sync moves them to the default branch's version while .teamai/ stays behind. --------- Co-authored-by: Saul Moro <[email protected]>
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
@gtref Thanks. This branch conflicts with main in src/team-push.ts. Main caused it: #1291 (97f1e7b4) rewrote the same reportUsageToTeam block. The update callback now always returns { files, message } with pushIfUnchanged: true, and it confirms vote deltas through onDelivered. The resolution decides what that function does after this refactor, so we'll review the rebased head instead of this one. Please rebase onto current main and keep #1291's retry behavior.
Signed-off-by: G-type <[email protected]>
The requested three-dot diff now succeeds, resolving the earlier review limitation. No PR code was run, built, or installed. |
|
@SaulMoro The latest commit should have pulled all recent changes and fixed merge issues in the team-push.ts file. Though it may still contain some issues. |
Signed-off-by: ydflow <[email protected]> Co-authored-by: ydflow <[email protected]>
- Use openclaw agent --message instead of the unsupported top-level -p option, keeping prompt text as one argument. - Give every AI task a fresh UUID session so parallel enrichment never shares the member's conversation or requests external reply delivery. - Preserve the existing plain-text response, process error and timeout handling for callers and other CLI backends. - Verify 19 AI-client tests, build, typecheck and lint, and a real-CLI code import with an isolated OpenClaw fixture producing the inferred domain metadata. Related to Tencent#1221.
…encent#1309) - Check the working directory before running automatic migration for write commands, while preserving the hook-dispatch exemption. - Exit with an actionable instruction to change directories instead of reporting uv_cwd as a failed migration and suggesting a futile retry. - Leave scope resolution and user data untouched when the caller's directory cannot be resolved. - Verify 17 migration and command-table tests, build, typecheck and lint, and three real-CLI error cases including a directory removed before Node starts. Related to Tencent#1221.
…#1307) - Record the installing Node executable and TeamAI CLI entry in generated handlers so gateway services do not depend on a shell PATH. - Spawn Node with separate script and dispatch arguments, avoiding Windows npm .cmd execution while preserving workspace and session payloads. - Keep dispatch nonblocking, hide Windows child consoles, and report a missing CLI entry before writing a partial installation. - Verify 77 focused tests, build, typecheck and lint, plus a real-CLI injection and dispatch with an empty service PATH. Related to Tencent#1221.
* fix(dashboard): style the workspace picker * fix(dashboard): style all dropdown menus
) * fix(skills): isolate files blocking tool skill directories - Stop the shared skill-directory guard at a regular file and preserve its contents, reporting the exact path and recovery command. - Skip blocked skill roots in both pull cleanup readers so Hermes cannot abort delivery to the scope's other tools with ENOTDIR. - Record blocked team-skill deliveries as incomplete so a plain pull retries after the file is moved, even when the team revision is unchanged. - Document recovery in English and Chinese; verify 359 focused regression tests, build, typecheck and lint, plus a real-CLI pull that preserves the blocker, delivers to Claude and restores Hermes on retry. Related to Tencent#1221. * fix(skills): preserve ownership handling at leaf skill paths - Limit the non-directory guard to parent directories; a file occupying the skill itself still reaches the existing ownership checks and Kept diagnostic. - Preserve the established member-file recovery flow while continuing to isolate a blocked Hermes skills root and retain its retry marker. - Reproduce the failing CI ownership case locally, then verify all 15 real-CLI ownership and blocked-directory cases, 131 skill regression tests, build, typecheck and lint.
…Tencent#1302) * refactor(session): centralize migration results and archive ownership - Return migration outcomes to one text/JSON renderer while preserving single-session JSON envelopes, batch progress, previews, reuse, and archive diagnostics. - Make archive save, delete, and index repair methods asynchronous lock-owning entry points; keep synchronous mutations private and expire reentrant ownership after the outer operation ends. - Declare fidelity, native tool, ID, Windows registration, and tool alias facts beside the adapter registry, and verify every registered platform supplies them. - Verify 325 focused tests, lint, typecheck, build, and a real-CLI Claude-to-CodeBuddy archive/pull round trip; the full suite passed 12,177 tests with only two independently reproduced baseline submodule failures. * fix(session): identify the archive copy that failed in a batch - Pass the currently archived target id and workspace into busy/save failure results, instead of naming the last session migrated in an --all batch. - Add a held-lock regression covering three copied sessions and the first failed archive; the regression fails before this change and passes after it. - Verify 73 session command tests, typecheck, lint and a build-first real CLI migration/archive round trip against an isolated home and local bare remote.
@gtref Thanks for the rebase. The conflict is gone, but this head has a new blocker. The earlier request stays open for it.
Not blocking:
|
* fix(hooks): render Cursor Windows hooks for PowerShell 5.1 Cursor runs the hooks.json command through PowerShell 5.1, which rejects || and does not invoke a quoted Git Bash path. Rewrite the builtin wrapper the same way Copilot's powershell field already does. Co-authored-by: Cursor <[email protected]> * docs(hooks): describe the Cursor rewrite as for all PowerShell The command must run on any PowerShell host Cursor uses, not only 5.1. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
…ncent#1315) - Match CodeBuddy's native separator and colon normalization instead of dropping the Windows drive, so C: and D: workspaces remain distinct. - Trim and collapse separator hyphens while preserving spaces, dots and underscores; CodeBuddy and WorkBuddy readers and writers share the fix. - Add Windows-path regression cases to the Windows CI test list and verify existing session list/copy behavior (104 focused tests). - Build and verify a real-CLI Claude-to-CodeBuddy-to-Claude round trip into a workspace containing consecutive hyphens and a space; the Windows test list also passes locally (669 passed, one platform skip). Refs Tencent#1221.
…#1318) - Include resolved claude-internal and tclaude instruction targets in the shared-file judgement used by the delivered Git exclude block. - Exclude a file only when complete TeamAI-managed blocks occupy all of its content; keep authored text, malformed/duplicate markers and tracked files visible using the existing tracking and delivery safeguards. - Reuse the instruction block editor to judge ownership without changing the instructions or introducing blanket directory exclusions. - Verify 269 focused unit tests and 10 real-CLI self-mode scenarios, including both internal editions, repeated pulls, member-text visibility and tracked instruction files; build and static checks also pass. Refs Tencent#1221.
* fix(hermes): quote managed hook script paths - Register the generated report script as a single quoted command so Hermes can tokenize homes containing spaces or apostrophes without breaking the executable path. - Replace legacy raw commands and their exact-match allowlist entries on injection, preserving unrelated member hooks and idempotent refreshes. - Remove both raw and quoted managed commands and approvals on uninstall, while keeping the script's filesystem path separate from its command representation. - Verify 63 focused tests, build, typecheck and lint, plus a real-CLI injection and session-start dispatch from a home containing spaces and an apostrophe. Related to Tencent#1221. * test(hermes): isolate POSIX hook execution from Windows coverage - Move the shell execution regression into its own POSIX-only test file, preserving its real script invocation and exact stdin/argv assertions. - Keep the allowlisted Hermes hooks tests free of POSIX shell and shebang fixtures so the repository's Windows portability guard can enforce its existing contract. - Reproduce the CI guard failure locally, then verify all 87 focused tests including the Windows file-list guard; typecheck and lint pass with no runtime changes.
) - Treat a Muse stdio entry without an explicit type as the same rendered definition when reading delivery state or reconciling managed servers. - Preserve the existing manifest hash representation so servers written before an upgrade remain owned after Muse saves settings.json. - Normalize only an unambiguous command-only Muse entry; preserve changed commands, extra fields and other tools' existing ownership behavior. - Add doctor and uninstall regression cases, including a member edit, and verify a built real CLI can inject, pull and uninstall a normalized server without leaving it behind. Type checking and lint also pass. Refs Tencent#1221.
…ent#1323) The session-start pull runs in the detached hook-dispatch --bg-only pass. pull() stops waiting for its usage report after 5 s, and the dispatcher's process.exit(0) then cut the push: the commit stayed in the local reports checkout and .reports-lock kept a dead PID. pull() now keeps the late report together with the release of its sync locks and exports settleLateUsageReport(); the pull handler awaits it before returning. The host does not wait for the detached pass, so the session is not delayed. Fixes Tencent#1322
…t#1330) - Resolve ZCode hooks through user-scope paths in every installation mode, and make reconciliation, hooks list and doctor inspect the same HOME CLI config. - Retire manifest-owned entries from the unread self-project file before recording their HOME replacements, preserving personal settings and unresolved team-hook ownership. - Gate team hooks to their project and retain other projects' hooks, global built-ins and the Windows launcher when removing one project's entries; persist its agent exclusion so a later pull cannot install it again. - Verify 923 related regression tests including migration/ownership, legacy sweeps, uninstall and path overrides, TypeScript, lint and build; the real CLI passes self init, hooks inject/list/remove, uninstall the ZCode doctor registration check and a post-uninstall pull.
- Check all default-workspace AGENTS.md content, including personal text, against OpenClaw's per-file and total bootstrap budgets. - Resolve OPENCLAW_CONFIG_PATH and state-directory config, match UTF-16 length and trailing-whitespace handling, and detect a total budget too small to load the first file. - Keep the file unchanged and explain which default-agent settings to review; document the scope and per-agent override limitation in both guide languages. - Verify 277 focused tests, TypeScript, lint and build; a real doctor CLI fixture fails the oversized-file check and passes it after shortening without automatic truncation.
* fix(import): reject invalid batch concurrency Signed-off-by: ydflow <[email protected]> * test(workflow): join delivery fixture background writers Signed-off-by: ydflow <[email protected]> --------- Signed-off-by: ydflow <[email protected]> Co-authored-by: ydflow <[email protected]>
- 在生成的 Pi 扩展中记录绝对 Node 与 TeamAI 入口,生命周期事件和项目上下文均直接启动该入口,避免依赖服务 PATH 或 Windows 命令包装器。 - 保留超时、标准输入、会话身份与失败放行行为,更新中英文重装后的刷新说明。 - 受限 PATH 的真实扩展回归在原始主干返回空上下文,修复后成功注入项目内容;191 项相关单测、CLI E2E、构建、类型检查和 lint 通过。
- 使用现有工具主目录解析器定位 Muse settings.json,使模型切换、安装判断、状态检查和恢复遵循已记录目录及 XDG_CONFIG_HOME。 - 保留默认目录的个人配置、迁移目录内的其他字段与 API 密钥导出规则,并同步中英文参考说明。 - 环境目录和已记录目录的两个回归在修改前失败;102 项相关单测、2 项真实 CLI 切换及恢复用例、构建、类型检查和 lint 通过。
- 使用统一 toolHome 解析 CodeBuddy models.json,使环境变量与机器记录的优先级和其他资源一致,避免模型配置写入无人读取的默认目录。 - 沿用模型所有权与还原机制,保留个人模型和默认目录文件;活动配置移动后拒绝迁移写入,恢复原目录记录后可安全还原。 - 补充环境变量与无变量记录的切换、还原、目录变更回归以及两个真实 CLI 场景;修复前 3 个目录用例失败。 - 81 个模型单测、两个真实 CLI 切换还原用例、构建、类型检查与 lint 通过,更新中英模型配置说明。
- 在生成的 OMP 扩展中保存绝对 Node 路径和 CLI 入口,生命周期分发及项目指令读取均通过 Bun 的参数数组启动。 - 保持 stdin 载荷、会话归属和非阻断行为;安装路径包含空格或宿主 PATH 中没有 teamai 时仍能调用正确的 CLI。 - 添加实际子进程回归和真实 CLI 安装后的扩展验证,并同步既有扩展测试替身的调用约定;修复前无法取得上下文。 - 27 个启动与扩展单测及 162 个采纳归属单测通过;构建、类型检查、lint、真实 CLI E2E 和本机 Bun 1.4.0 离线验证通过。
* fix(score): keep workspace children when scoring a session score --session re-resolves the session's scope from its directory, but dropped the workspace children before reading the scoring settings, so a namespace only a child selects never applied its isolation. * fix(score): name the scorer file that asks for verified isolation When no judge tool here reaches verified isolation, score --session now says which file asks for it, with the scorer's own path, as a lease refusal does. * refactor(scorers): list the scoring.yaml keys once The parser and the unknown-key problem read one list, and the parser's switch fails to compile on a key it does not handle. * refactor(score): share the session read, evidence and label One read of a session gives the evidence and the label context, so a session judge lease can build both as score --session does. Output is unchanged. * refactor(scorers): name each attempt's source An attempt is now a workflow attempt or a session attempt. A session attempt keeps the label context of the session read its lease took, which only an unreadable session may lack. Workflow attempt files are written as before, without a source. judgeLease takes the time it settles at from its caller. * feat(score): hand out finished sessions as judge work A member who sets scoring.sessions: true now gets each captured session that has been idle for six hours as judge work for every scorer with sessions: true. score --next hands out workflow work first, then sessions, and the lease carries source and the cwd to submit from. A session key is tried once. The session is read before the attempts lock and the lease is written in one step under it. A failed local judge closes the key, a lease left out of running lapses rather than being handed back, and a late answer is refused once a judge has labelled the session. * feat(score): cap session launches per day A member can set scoring.daily_limit to bound how many sessions one data home leases per local day; 0 turns session scoring off. Every session attempt counts, including ones that failed or could not be read, so a broken session cannot spend the budget again. Once the day is spent, idle no longer counts sessions as open. * feat(score): team defaults for session scoring A team can now turn session scoring on, and bound it, for every member from scorers/scoring.yaml or a namespace's scoring.yaml. A member's config.yaml still wins. Between active namespaces the cautious value wins: sessions: false, and the lowest daily_limit. * feat(score): scope session scorers by the capture's selection A namespace scorer should only judge sessions that were delivered its namespace. Each capture's recorded selection is overlaid on the scope and resolved with the same namespace resolver pull uses. Workspace children count only while their fingerprint still matches. A session whose captures record no selection, or disagree, gets root and shared scorers only. * feat(score): add the hidden score-sessions driver Finished sessions need a driver that runs without anyone asking. This one takes session work only, for the project scope and then the user scope, judges each lease with a local tool, tries verified tools first and then every tool at best-effort, and stops taking work after 30 minutes. A per-data-home lock keeps two runs from overlapping. Labels stay pending; the next pull publishes them, so a background run never pushes per label. * feat(hooks): score finished sessions after a session start's pull Without a trigger, finished sessions would only be judged when someone runs a driver. The session-start pull now starts score-sessions as a detached process once the pull and its late usage report have settled, and only when the session's project or the user scope scores sessions, so members who never turn it on pay nothing. * fix(score): give background judges the recorded tool homes A judge started from the background hook pass may not inherit the member's shell, so a moved Claude, Codex or CodeBuddy home was missing and the tool judged with the wrong account or none. When the variable is unset, the judge now gets the home teamai recorded for the tool. Its settings were already read from there. * fix(score): prune attempts of sessions that are gone Session attempts are kept so a key is tried only once, which would let them grow without end. Once no capture of a session is left it can never be judge work again, so its attempts are removed under the attempts lock, from the captures already listed for the lease, unless one is live or was leased today and still counts towards the daily limit.
) * fix(import): bound GitLab organization list requests * test(workflow): bound cancellation fixture waits and cleanup --------- Co-authored-by: ydflow <[email protected]>
…ber (Tencent#1186) (Tencent#1191) * feat(roles): assign roles in manifest/members.yaml instead of per member (Tencent#1186) A member's roles were a local setting: `teamai roles set` wrote them into that member's own config, and nothing said who may hold which role. For a team that also uses the effective roles to bound its agents, that bound is one the agent can lift by the same means the member has. `manifest/members.yaml` makes the assignment team data, reviewed in the team repo like `roles.yaml` is, and the forge decides who may change it: version: 1 members: alice: [frontend] bob: [backend, ki] default: [] While the file exists, a member's effective roles are the ones assigned there. The roles are overlaid onto the config where it is loaded, so every reader — pull, push placement, the namespace filter, per-entry role scopes, the dashboard, child workspaces — sees the assignment unchanged. The overlay is runtime-only: a save by any other command writes the member's own selection back, so no stale copy of an assignment is left in the config file. Nothing falls back to an unfiltered sync any more: a member the file does not list holds `default` and receives shared resources only, and a file that cannot be read, or that names a role `roles.yaml` does not declare, leaves fewer roles rather than more. `roles set` refuses, naming the file; so does `--role` at init and the dashboard's role editor. `roles list --json` reports the effective roles and their source (`assigned`, `default`, `local`, `none`) for team hooks, which otherwise parse teamai's config file. `pull` re-resolves the assignment after it refreshes the team repo, so a reassignment takes effect on the pull that fetches it instead of the one after. This is not a boundary against a process running as the member; it makes a role change a reviewed team decision with a history. * fix(roles): keep a refresh failure out of pull's fetch error path (Tencent#1186) The re-resolution of manifest/members.yaml sat inside the try that reports a failed team repo fetch, so anything it threw was reported as "Pull failed" and took the rest of the scope's pull with it. It belongs after that block: the refresh runs only once the fetch succeeded, and a failure of its own is not a failure to fetch. * fix(roles): resolve the assignment where pull and init actually use it (Tencent#1186) Review of Tencent#1191 found two places the overlay did not reach. `refreshRoleAssignment` returned a new config, and only `pullForScope` held it. The hook, MCP and env stages that run after a scope reconcile the object `pull` itself holds, and they look up `teamEnvs` and `instructions` by that object's identity. So a reassignment reached the resource sync but not the reconcilers — which kept the old role's hooks, MCP servers and env — and the two maps were keyed on an object nothing looked up again. It now mutates the config in place and returns nothing. `init` builds its config in memory and hands it straight to that same reconciliation, before any load can overlay it. The assignment branch of the role prompt returned no role at all, so the config arrived role-less, and a role-less config matches every role-scoped entry: a member assigned `frontend` had `backend`'s hooks installed at init, and an unlisted member received role-scoped hooks instead of none. Every init path now applies the assignment after the role profile and before reconciliation. Nothing is persisted: the save keeps the member's own selection, which an assignment leaves empty. The e2e case added for init applies `be-stop` to a frontend-only member without the fix, so it fails for the reason it was written. * fix(roles): clear a stale roleUnresolved on refresh (Tencent#1186) A broken manifest/roles.yaml at load marks a role-less config roleUnresolved. When pull then fetches a fixed manifest and a members.yaml, refreshRoleAssignment applied the assigned role but kept the flag, so activeRoleIds still returned [] and role-scoped hooks, MCP entries and env were skipped on that pull. The refresh now drops the flag when it resolves an assignment, the state a load reaches, where the legacy migration is skipped once an assignment exists. * fix(roles): load without the migration notice for roles list --json (Tencent#1186) The dry-run load previewed the legacy role migration before the JSON, so a hook parsing the output broke. Suppress the notice for --json only. * feat(roles): read members.yaml from the fetched default branch (Tencent#1186) The assignments were read from the clone's working tree, so one local edit, deletion or unpushed commit changed a member's roles. Read them from origin/<default> as last fetched instead: only what the forge merged counts, and a copy only the working tree has is absent. An HTTP source has no git of its own and sits inside whatever repository holds the config, so it keeps reading its materialized files. So does a repo with no fetched default branch to prefer. * fix(pull): leave the revision fast path when the delivered selection changed (Tencent#1186) A reassignment in manifest/members.yaml arrives with the fetch. A pinned workspace reads it from origin/<default>, so its checked-out revision does not move, and the fast path reported "Already synced" with the newly assigned skills undelivered until --force. A local selection change clears lastPullRev; an assignment has no command to do that. Compare the record's own delivered selection instead. A record without one, from an older CLI, reads as unchanged. * fix(pull): key the fast path on the roles delivered for, assigned or not (Tencent#1186) The checkout record's selection now says whether manifest/members.yaml assigned the roles: a role-less member goes from every namespace to the shared root when the file appears, with no role list changing and no revision moving in a pinned checkout. Compare only the roles part of the selection. The rest changes through commands that clear lastPullRev, and comparing it all made a config edited by hand resync where it kept the fast path before, which the push-active-namespaces e2e relies on. * fix(roles): keep load warnings off stdout for roles list --json (Tencent#1186) The load warns about an assigned role roles.yaml does not declare, or a members.yaml it cannot read, and a hook parses stdout whole. Route every log line to stderr for --json, as doctor --json does, and put the route back afterwards. The member guide and the admin skill now say that a team assigning roles in manifest/members.yaml refuses roles set. The e2e skill fixture gains frontmatter, so a withdrawal removes the copy instead of keeping it as unverifiable, and the cases assert the removal. --------- Co-authored-by: Nils Schiller <[email protected]>
- 让 opt-in judge 接受 Codex、Muse 与 ZCode Stop 事件中的 last_assistant_message,不再强制要求 Claude 格式 transcript。 - 从同一会话已确认并关联的 recall 日志提取候选路径及投票键,继续保留作用域 eligibility、受信知识根校验与每会话投票账本去重。 - 新增三种工具的原生回复、重复 Stop、继承用户范围只读和伪造召回标记回归,更新中英说明及技能排查指南。 - 329 个评分与会话归属单测、构建、类型检查、lint 和隔离模型替身的真实 CLI recall/Stop/投票 E2E 通过;修复前三个原生回复用例失败。
|
@SaulMoro Sorry, but I was unable to recreate the behavior on my fork and so I can not find the compiling issues. I will keep trying to find them. |
@gtref The errors come from the PR's head commit itself, 4081438 (the merge of your fork's The CI run on this head shows the same 8 errors. One way out: rebase 4b19d2f onto current |
|
Oh, sorry for that. |
Signed-off-by: G-type <[email protected]>
The exact three-dot diff succeeds, resolving the earlier merge-base limitation. No PR code was run, built, or installed. |
|
@SaulMoro Hi, I'm a bit stuck trying to apply the review feedback. I rebased and resolved the conflicts in
The strange part is that I selected the side that appeared to remove the if (useReportsBranch && reportsConfig) {I'm not sure if I've misunderstood which side should be kept, or if another part of the rebase reintroduced the old code. Could you point me at the exact block that should remain in |
@gtref Re-checked at f45eccc. The new commits leave
GitHub's file list compares against an old base and shows about 100 files. Against current |
|
@SaulMoro I apologize but git keeps rebasing to the version with the conditional branch causing the error. Also every time I attempt to apply the patch it keeps reverting. I apologize but this pr may take some time to fix up. |
…-push retry The merge reintroduced the useReportsBranch check and the clone-reset else branch, so the head did not compile and pull skipped every report. Remove both, and return the files on every attempt again so a retry still pushes a commit left unpushed (Tencent#1291).
Resolved: The undefined report references and obsolete fallback are removed; The exact three-dot diff succeeds, resolving the earlier merge-base limitation. No PR code was run, built, or installed. |
Resolved:
The exact three-dot diff succeeds. No PR code was run, built, or installed. |
SaulMoro
left a comment
There was a problem hiding this comment.
Thanks @gtref. The merge had brought back the useReportsBranch check and the clone-reset branch, so I pushed 8c13deb on top: it removes both and restores the always-return { files, message } from #1291. tsc, lint, the full unit suite and the report e2e files pass, and a real teamai pull publishes to teamai-reports (record in the description).
The bot's scope finding compares against the stale PR base. Against current main the merge ref changes three files.
…eToTeam (Tencent#1293) reportUsageToTeam now requires selfConfig and always writes through the teamai-reports branch. The legacy branch that reset the team-repo clone had no caller, and since Tencent#1253 it could delete untracked files in the clone. An HTTP repo returns false before any report I/O. The updateReports callback keeps returning the files on every attempt, so a retry still pushes a commit left unpushed (Tencent#1291). Closes Tencent#1259 Co-authored-by: Saul Moro <[email protected]>
Summary
Drops the unreachable clone-reset path in
reportUsageToTeam(#1259).options.selfConfigis required. The only production caller (src/pull.ts) already passes it.elsebranch (resetToCleanMaster/pullRepo/pushRepoDirectlyon the team-repo clone) and its imports are gone. Every report goes through theteamai-reportsbranch writer.falsewith a debug log before any report I/O. The caller already skips HTTP repos.updateReportscallback still returns{ files, message }on every attempt withpushIfUnchanged: true, so a retry pushes a commit left unpushed (fix(reports): retry pushes with existing report content #1291).Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpassesTests removed, each covering only the deleted branch (calls without
selfConfig):self-mode-no-business-reset.test.ts: "self mode: uncommitted change + non-master branch survive reportUsageToTeam" and "project scope (git kind): business repo is NOT reset when team-repo dir lacks its own .git".team-push-interventions.test.ts: thelegacycase of "finishes acknowledgement after the caller times out". A new case covers the HTTP early return.Real CLI, after
npm run build:One manual
teamai --verbose pullwith agitprovider, a local bare remote, and one usage event for a team skill:Related Issues
Closes #1259
Notes for Reviewers
GitHub's file list compares against an old base. Against current
mainthe PR changes three files.