Skip to content

fix(grep): propagate later-page ACL denials - #5289

Merged
cocolord merged 1 commit into
volcengine:mainfrom
cocolord:codex/grep-pagination-acl-consistency
Sep 23, 2026
Merged

cocolord merged 1 commit into
volcengine:mainfrom
cocolord:codex/grep-pagination-acl-consistency

Conversation

@cocolord

@cocolord cocolord commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

修复 #5270 合入后出现的分页边界回归:fallback grep 已经成功读取子目录第一页后,如果后续页发生 ACL 拒绝,不能把已读取的部分结果当作完整结果返回。

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Fixes #5287

Follow-up to #5263 / #5270.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • 保留非根子目录第一页 ACL 拒绝时的现有跳过行为
  • 子目录已经消费至少一页后,后续页 ACL 拒绝向上抛出
  • 增加 focused regression,防止不完整结果被伪装成成功

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing relevant unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Validation:

  • 11 passed, 32 deselected for the fallback traversal focused tests
  • full tests/storage/test_viking_fs_grep.py: 41 passed, with 2 unchanged baseline ACL test failures caused by synchronous is_enabled() stubs
  • Ruff check passed
  • git diff --check passed

Checklist

  • My code follows the project coding style
  • I have performed a self-review
  • The non-obvious first-page/later-page distinction is documented inline
  • Documentation update is not needed because this restores the existing completeness contract
  • No new warnings were introduced
  • The prerequisite pagination change has already merged

Additional Notes

This is intentionally a one-branch fix in the existing traversal owner. It does not change pagination size, DFS order, first-page ACL subtree handling, or result limits.

Final-version acceptance at c61ca00: required CI passed; complete wheel/source and isolated K8s runtime hashes verified. HTTP E2E and Tesla each passed 8/8 targeted pagination/filter/depth cases, including 10,000 archive directories. The final container also passed the 1,001-file later-page ACL fault-injection probe and six ACL boundary cases. Tesla queried this isolated image through a restricted K8s service proxy.

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

@cocolord cocolord left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

Reviewed head: c61ca006d02409af1556055a5e092257564523e8

动机

#5287 描述的缺陷成立:目录第一页成功、后续页 ACL 拒绝时,旧代码会成功返回第一页产生的部分结果。调用方无法判断搜索并不完整。

改动思路

在既有 _collect_grep_files 异常分支判断 offset > 0,复用分页游标作为“已经消费页面”的依据,无需新增状态。子目录首拒继续跳过;根目录拒绝和后续页拒绝向上传播。这是该问题的最小修复。

具体改动

关键代码讲解

  • _collect_grep_files:唯一生产行为变化是后续页权限异常传播;分页大小、DFS 遍历、exclude 和深度过滤沿用原逻辑。
  • _grep_encrypted:先完成文件收集再扫描,收集失败会中断调用,无法把已收集文件包装成成功结果。
  • 回归测试覆盖子目录成功一页后被拒绝的路径。额外审计覆盖根目录第 1/2 页、子目录第 1/2/3 页、深层子目录后续页,共 6 种边界。

对主干的风险

用真实 RAGFS localfs 的 1,001 个文件通过 VikingFS.grep() 验证,并仅在第二页 listing 边界注入权限撤销:修复前返回 1,000 条部分结果,修复后抛出 PermissionDeniedError。首拒行为与无故障分页结果未变。

grep、URI guard、FS service 三份测试共 152 个通过;两处失败在最新 main 同样复现,根因是既有 ACL fixture 将 async is_enabled 写成同步方法。临时修正测试 fixture 后,grep 文件 43/43 通过。Ruff、diff check 与远端必跑 CI 通过。

我的整体评价

#5287 的代码修复完整,本轮未发现这份补丁引入新的回归。最终环境验收暂缓。 目前隔离 K8s 中运行的镜像早于这个提交,尚无该完整版本的 K8s E2E/Tesla 结果;不能把旧镜像上的诊断当作最终验收。因此此处保留验证缺口,未给出合入批准。

English verdict: HOLD / REQUEST_CHANGES for final-version environment evidence at c61ca006d02409af1556055a5e092257564523e8. The #5287 code fix passes the baseline-versus-head localfs regression and six ACL boundaries; no new code defect found. Exact-version isolated K8s E2E/Tesla acceptance remains unverified.

@cocolord cocolord left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

Reviewed head: c61ca006d02409af1556055a5e092257564523e8

动机

#5287 描述的缺陷成立:目录第一页成功、后续页 ACL 拒绝时,旧代码会成功返回第一页产生的部分结果。调用方无法判断搜索并不完整。

改动思路

在既有 _collect_grep_files 异常分支判断 offset > 0,复用分页游标作为“已经消费页面”的依据,无需新增状态。子目录首拒继续跳过;根目录拒绝和后续页拒绝向上传播。这是该问题的最小修复。

具体改动

关键代码讲解

  • _collect_grep_files:唯一生产行为变化是后续页权限异常传播;分页大小、DFS 遍历、exclude 和深度过滤沿用原逻辑。
  • _grep_encrypted:先完成文件收集再扫描,收集失败会中断调用,无法把已收集文件包装成成功结果。
  • 回归测试覆盖子目录成功一页后被拒绝的路径。额外审计覆盖根目录第 1/2 页、子目录第 1/2/3 页、深层子目录后续页,共 6 种边界。

对主干的风险

用真实 RAGFS localfs 的 1,001 个文件通过 VikingFS.grep() 验证,并仅在第二页 listing 边界注入权限撤销:修复前返回 1,000 条部分结果,修复后抛出 PermissionDeniedError。首拒行为与无故障分页结果未变。

grep、URI guard、FS service 三份测试共 152 个通过;两处失败在最新 main 同样复现,根因是既有 ACL fixture 将 async is_enabled 写成同步方法。临时修正测试 fixture 后,grep 文件 43/43 通过。Ruff、diff check 与远端必跑 CI 通过。

我的整体评价

最终提交 c61ca00 的验收已完成,解除上一轮仅因环境证据缺失而保留的 HOLD。全部必跑 CI 通过;Linux wheel 的 743 个 Python 源文件与提交逐个核对,隔离 K8s Pod 内 749 个运行时文件与 wheel 哈希一致,未使用单文件源码覆盖。

隔离 HTTP E2E 8/8 通过,覆盖999/1000/1001/10000 个 archive、exclude、node limit 和深度限制。Tesla 使用同一用例,经仅限指定测试服务的 K8s API proxy 访问该最终镜像,8/8 通过,0 失败、0 跳过。测试数据直接写入隔离 localfs,查询经过实际 HTTP API;这是一组面向本次 grep 修复的 E2E,并非整个产品的全量回归。 最终镜像内另外通过真实 1,001 文件的后续页权限撤销探针和 6 种 ACL 边界;权限撤销由测试在 listing 边界注入,并非 HTTP 管理接口并发改权。

当前完整 diff 未发现阻塞性实现问题,验收结论为 APPROVE。此前披露的两个基线 ACL fixture 失败仍独立于本修复。

English verdict: APPROVE at c61ca00. Required CI passed; the complete Linux package and isolated K8s runtime were verified against the reviewed commit. Targeted HTTP E2E and Tesla both passed 8/8 cases against that image through a restricted K8s service proxy. No blocking implementation finding remains within this change's scope.

@cocolord
cocolord merged commit aa7a202 into volcengine:main Sep 23, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Sep 23, 2026
MaojiaSheng pushed a commit to MaojiaSheng/OpenViking that referenced this pull request Sep 24, 2026
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
frankyang2008-eng added a commit to frankyang2008-eng/OpenViking that referenced this pull request Oct 9, 2026
…I plugin, account-scoped embedding/VLM providers, resource permission management, ls/tree pagination)

Upstream: 7b07c4a -> 3949b51 (57 commits, 518 files, +29307/-7524), post-v0.4.21.

Themes
- plugins: Kimi Code CLI memory plugin (volcengine#4787) with manifest alignment (volcengine#5376);
  shared capture filtering across adapters (volcengine#5359, volcengine#5375); find the installer
  runtime in the fetched checkout (volcengine#5280); dsh bundle/plugin card (volcengine#5390, volcengine#5362),
  producer-owned source kind (volcengine#5318), broad MCP recall scope (volcengine#5346), per-session
  workspace peer settings (volcengine#5380); OpenCode v2 support (volcengine#5341), parallel
  session-inject and recall (volcengine#5149)
- config: isolate account runtime resources (volcengine#5323) - RuntimeConfigManager plus
  account-scoped embedding/VLM providers, which is what the embedding_provider /
  vlm_resolver plumbing in this merge serves
- acl: inherit full-management permissions by default with create-time
  authorization (volcengine#5266); web-studio resource permission management (volcengine#5329)
- fs: pagination state for ls and tree (volcengine#5330), unified URI normalization with
  Chinese path support (volcengine#5328), serialize mkdir abstract creation (volcengine#5183)
- grep: propagate later-page ACL denials (volcengine#5289); drop the ripgrep invoke
  (volcengine#5369)
- queue: requeue on semantic directory lock conflicts (volcengine#5340), fix the missing
  downstream index task on write-wait (volcengine#5357)
- metrics: queue processing latency (volcengine#5365), persisted HTTP retrieval result
  counts (volcengine#5294); observer JSON status format (volcengine#5316)
- openclaw: stop offering the legacy person peer role at install time (volcengine#5355),
  widen to unscoped recall when peer_role=sender has no sender (volcengine#5347)
- session: split session.py into sub-modules (volcengine#5363)
- hermes: gateway memory presets and sender attribution (volcengine#5293), rotate
  read-only session state (volcengine#5372), mirror native memory replacements/removals
  (volcengine#5281), bind settings to the initialized profile (volcengine#5374), skip writes for
  non-primary agent contexts (volcengine#5353)
- docs: enterprise deployment guides (volcengine#5361, volcengine#5388), browser-language docs
  preferences (volcengine#5351); feishu project auth refresh (volcengine#5350)

Conflicts (15) and resolutions - full analysis in
plans/upstream-sync-14-conflict-analysis.md

- openviking/models/vlm/token_usage.py - took upstream. The fork made
  TokenUsageTracker thread-safe with an RLock and hand-written locks; upstream
  shipped the same intent more completely (a @_locked decorator, _add_usage()
  that also merges last_updated, and a merge() that iterates a to_dict()
  snapshot instead of a live model map). Upstream is a superset, so the fork's
  version carries no information the merge would lose.
- examples/agent-hook-plugin/hosts/zcode-capture.mjs,
  examples/dsh-memory-plugin/index.mjs,
  examples/openclaw-plugin/tests/ut/identity-routing.test.ts,
  docs/en/agent-integrations/17-dsh.md,
  docs/zh/agent-integrations/17-dsh.md, docs/en/api/03-filesystem.md - took
  upstream. Every fork change on these files is Prettier/markdown noise
  (re-wrapping, table pipes, arrow parens); verified by comparing base to the
  fork tip with whitespace, commas and semicolons stripped. The repository has
  no prettier/markdownlint/yamllint config and CI does not run them, so keeping
  the formatting only re-conflicts on every sync. identity-routing.test.ts also
  had to take upstream on semantics: the fork still asserted a throw for a
  sender-scoped call without a sender, which upstream replaced with a warning
  plus unscoped fallback.
- openviking/service/core.py - union of three hunks. Kept the fork's
  _init_shared_rerank_runtime() call and the shared rerank client/executor, and
  took upstream's _init_runtime_config_manager() plus the VLM resolver check.
  Upstream's removal of the process-level embedder check is taken as-is: the
  attribute is no longer assigned anywhere upstream, so keeping the check would
  raise on every boot. The rerank runtime is initialized after the config
  manager, matching upstream's use of the same config reference for
  init_viking_fs(rerank_config=...).
- openviking/service/debug_service.py - the constructor and set_dependencies now
  accept rerank_client together with upstream's embedding_provider and
  vlm_resolver, in that positional order. The models-status path reuses the
  service-shared rerank client and only falls back to building one. The fork's
  "if self._config.embedding: embedding_instance = get_embedder()" block is
  dropped: upstream replaced the process-level embedder with the token-tracker
  namespace, so keeping it would resurrect the deleted embedder.
- openviking/storage/queuefs/queue_manager.py - union. The fork's shared
  "qfs-agfs" ThreadPoolExecutor and _agfs_call_timeout survive next to
  upstream's optional VLMResolver plus the TYPE_CHECKING import.
- openviking/session/memory/patch_merge_context_provider.py - union of imports;
  the fork's consumer="patch_merge" attribution survives.
- examples/pi-coding-agent-extension/index.ts - took upstream on both hunks
  (comment plus Prettier wrapping). The fork's omp getBranch() fallback and the
  WeakMap identity map live in non-conflicting regions and are preserved.
- examples/openclaw-plugin/commands/setup.ts, setup-helper/install.js - took
  upstream's peer-role semantics. Upstream added normalizePeerRoleInput(), which
  rejects "person" for setup input while still reading it from existing configs;
  the fork side of the setup.ts hunk lacks that definition while other code
  calls it, so taking the fork would break at runtime. All five install.js
  conflicts are the same change plus Prettier wrapping.
- examples/memory-plugin-shared/install.sh (20 hunks) - union. Upstream adds the
  kimicode harness, the fork adds qoder, codebuddy, omp and agy; both extend the
  same lists, so every hunk keeps both, in the order zcode, kimicode, qoder,
  codebuddy, omp, agy. copy_agent_integration() keeps upstream's explicit
  destination argument and the fork's host-specific source lookup side by side.
  This also fixes a fork bug found while resolving tui_item_at(): the missing
  i=$((i + 1)) between zcode and qoder left qoder without an index of its own
  (the row was unreachable and "add" was rendered twice), and
  tui_selectable_count() now says 12.
- docs/maintenance: plans/upstream-sync-14-conflict-analysis.md records the
  per-file evidence, the TUI index/count self-check, and the report-only
  convention for upstream-owned lint/type debt.

Not touched
- No file that is byte-identical to upstream/main was modified; upstream-owned
  lint/type debt stays report-only per the convention established in the 12th
  and 13th syncs (plans/upstream-type-debt-20260917.md).

Verified
- git grep for conflict markers: clean
- bash -n install.sh, node --check on every merged .js/.mjs, ast.parse on every
  merged .py: pass
- local work still present on top of main: core.py +49, debug_service.py 14,
  queue_manager.py 125, install.sh +682, install.js 1588, setup.ts 530,
  pi-coding-agent-extension 95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: fallback grep 在后续分页发生 ACL 拒绝时会返回不完整结果

2 participants