Skip to content

fix(apps): close six review defects in host, compare, delivery and views - #605

Merged
Dong1017 merged 9 commits into
mainfrom
impl/595-apps
Nov 25, 2026
Merged

Dong1017 merged 9 commits into
mainfrom
impl/595-apps

Conversation

@Dong1017

@Dong1017 Dong1017 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Governing Issue and delivery slice

Refs #595

Knowledge authorship declaration

No path protected by docs/knowledge-model-policy.md changes. The declaration below is disclosure only.

{"schema_version":1,"head_sha":"8ffb1536de588ade8b1bf39c6a7bfabee5510fa6","human_only":false,"material_ai_authors":[{"tool":"Claude Code","model_id":"claude-opus-5-5","effort":"xhigh","role":"author"}]}

Changed artifacts and evidence

Requirement (#595) Actual change Regression test (fails on main, passes here) Remaining gap
AE-02: CUDA inspection accepts L4 for an L40S apps/host/platforms/cuda.py: one _names_model whole-token, case-insensitive match used by both inspect_devices and qualify_devices test_inspection.py::test_cuda_model_must_be_a_whole_token_of_the_reported_name; test_module_boundaries.py::test_cuda_qualification_accepts_campaign_supplied_count_and_sku gains an H10 vs H100 case Ascend/ROCm still use their normalized substring rule (parsed_tool_facts); not in #595
AE-03: compare --action status fails on one unreadable job apps/workflows/benchmark_compare.py _status: OSError/ValueError from one job's agent_sessions.status marks that trial blocked with the error type, the same reading report already applies test_benchmark_compare.py::test_bad_native_receipt_keeps_verified_arm_in_report (six damage cases) now also calls compare.status and expects the same next action as report none
AE-04: delivery fails when the session path has a symlinked ancestor apps/delivery/__init__.py after_final exports from result["session"], the resolved root Harness committed final under, and does not touch the caller's path again (review: resolving it could fail after the commit) test_project_optimization.py::test_final_delivery_publishes_through_a_symlinked_session_path reaches the session through a directory symlink; test_final_delivery_never_resolves_the_session_path_after_commit makes the session path fail to resolve once final is committed and expects the committed result plus a published delivery. The root cause is OS-independent, so Linux and Windows reproduce the macOS /tmp case. none
AVI-01: the service-reuse dashboard cannot be rewritten apps/views/dashboard.py: the service page carries the InferRSI dashboard generator tag the writer checks. CHANGELOG.md notes that a page written before this fix has no marker and needs a new output path or removal test_dashboard_service_page.py writes the page twice; test_project_service_reuse.py::test_knowledge_and_dashboard_never_enter_legacy_fingerprint_readers now calls write_dashboard twice on a real service campaign none
AVI-02: wrapped shell searches count as "no retrieval, complete" apps/views/codex_search.py: options before -c and a leading env NAME=value are unwrapped; pwsh/powershell/cmd/fish, script files, a -c after -- and env options this reader cannot interpret are recorded as incomplete. Program names, including the inner tool name, are split on both / and \ without .exe, so a Windows-recorded command reads the same on POSIX; a shell, opaque interpreter or env in command position after one unwrap is incomplete, as the same command run directly is; an unquoted newline in a script is a command boundary, so each line's first word is checked; each simple command's program is found after reserved words (if, then, do, !, ...) and NAME=value words, and a shell, env, a code builtin (eval, source, ., exec, command, builtin) or a non-supported program handed a shell (nohup bash x) there is incomplete; an unquoted, unescaped lone & separates commands; any other unquoted run of &, ` , <, > that is not already a supported operator (&>, >&, <&, &, >
AVI-04: the read agent emits no agent.failed for missing_task or workspace_symlink apps/integrations/anthropic/anthropic_agent.py run_agent: exposed_files runs inside the existing failure handler test_anthropic_agent.py::test_missing_task_is_retained_as_a_failure_before_transport; test_symlink_workspace_is_rejected_before_transport now asserts the event none

Checks and dependencies

  • Checks actually run (result and tested scope):
    • H200 (Linux, Python 3.10). Ran manifest-verified git archive trees of main 3b1b4ce (old) and 5b2127a (cand) over the related test files: test_codex_*, test_dashboard*, test_anthropic*, test_inspection, test_mlx_discovery, test_module_boundaries, test_benchmark_compare, test_project_optimization, test_project_service_reuse and test_*delivery*.
      • old: 85 failed, 696 passed.
      • cand: 85 failed, 705 passed.
      • Candidate-only FAILED/ERROR/SUBFAILED lines: 0.
      • The 85 shared failures come from the host: git 2.34 lacks --no-lazy-fetch, and service-reuse precheck deadlines are too short there.
    • H200, new tests against the old source. The candidate's tests were run against main's src: all 17 new or changed regression cases failed.
    • Head 5d6c962. It differs from 5b2127a only by tests/test_dashboard_service_page.py. Locally on Windows with Python 3.13, that file passes, and it fails with main's dashboard.py.
    • Review fixes, head ef8cda3 (H200, Linux, Python 3.12). Manifest-verified trees of the previous head 5d6c962 (old) and 7c43817 (cand) over the same related files without test_project_service_reuse: old 3 failed, 696 passed; cand 3 failed, 702 passed; candidate-only failures 0 (the 3 shared are the host's git 2.34 and non-macOS MLX cases). The cand tests against the old source: the delivery-after-commit test and four Windows-path shell cases fail. ef8cda3 differs from 7c43817 only by test_dash_c_after_double_dash_names_a_script_file in tests/test_codex_search_shell_forms.py; that file, copied into both trees, gives cand 12 passed and old source 5 failed (the four Windows-path cases and the -- case).
    • Other local checks. ruff check (0.14.10) on all changed files passed. git diff --check is clean.
    • Second review round, head a00314b (H200, Linux, Python 3.12). Manifest-verified trees of ef8cda3 (old) and a00314b (cand) over test_codex_*, test_round_citations*, test_*search* and test_dashboard*: old 389 passed, cand 400 passed; candidate-only failures 0. The 9 new cases fail against the ef8cda3 source.
    • Third review round, head 071cb6a (H200, Linux, Python 3.12). Manifest-verified trees of a00314b (old) and 071cb6a (cand) over the same files as the second round: old 400 passed, cand 407 passed; candidate-only failures 0. Against the a00314b source, 3 of the 7 new cases fail: the two scripts that start a shell on a later line and the line-boundary test. The other 4 also pass there; they guard behavior that already held (&& before a newline, quoted and trailing newlines, the Windows wrapper).
    • Fourth review round, head 08cecd8 (H200, Linux, Python 3.12). Manifest-verified trees of 071cb6a (old) and 08cecd8 (cand) over the same files as the third round: old 407 passed, cand 422 passed; candidate-only failures 0. The new test file run against the 071cb6a source: 12 cases fail, the 12 new unreadable-form cases. The other new cases guard behavior that already held (rg -n if docs, a quoted $(...) argument, cd docs && ls as no retrieval).
    • Fifth review round, head 3876021 (H200, Linux, Python 3.12). Manifest-verified trees of 08cecd8 (old) and 3876021 (cand) over the same files as the earlier rounds: old 422 passed, cand 430 passed; candidate-only failures 0. The new test file run against the 08cecd8 source: 4 cases fail, the three literal-& cases and the background-boundary case. The other new cases guard behavior that already held.
    • Sixth review round, head 8ffb153 (H200, Linux, Python 3.12). Manifest-verified trees of 3876021 (old) and 8ffb153 (cand) over the same files as the earlier rounds: old 430 passed, cand 444 passed; candidate-only failures 0. The new test file run against the 3876021 source: 13 cases fail, the nine _command cases and the four normalization cases; the three quoted-argument cases also pass there.
  • Failed, skipped, timed-out or not-run checks (if applicable):
    • The real service-reuse test (test_knowledge_and_dashboard_never_enter_legacy_fingerprint_readers) fails on both trees on H200 and on this laptop, before it reaches the new assertion, because the service precheck exceeds its deadline. Hosted CI runs it.
    • No macOS run; the AE-04 test does not depend on the OS.
  • Dependencies / shared interfaces / integration assumptions (if applicable): No file in _runtime_identity() changes, so existing sessions are unaffected.

Remaining work and Issue closure

🤖 Generated with Claude Code

CUDA inspection matched the requested model as a substring, so L4
accepted an L40S. Inspection and qualification now share one
whole-token match.

compare --action status read every trial's job without error handling,
so one damaged or locked job failed the command. An unreadable job now
blocks only its trial, the same reading report already applies.

after_final passed the unresolved session path to the exporter, which
refuses symlinked ancestors; a session reached through a symlink
committed its final but never published delivery. The path is resolved
first.

The service-reuse dashboard page lacked the generator tag the writer
checks before replacing a page, so a second write was refused.

The Codex search import unwrapped only [shell, -c, script]. Shell
options before -c and a leading env are now unwrapped; other shells and
script files count as incomplete coverage instead of no retrieval.

The read agent listed the workspace before its failure handler, so a
missing task or a symlinked workspace emitted no agent.failed event.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
@Dong1017 Dong1017 added area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters kind:task Bounded delivery task with a delegated slice labels Nov 23, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS
dot, acting for @zengchuang-hw

Independent first review: 214fb400b678db7f03f2d865e3b80c1fbf97d6bd..5d6c96231c05af38e9952b92680781df463cd42f, #595 Group 2 only.

Before approval (AE-04): after_final now resolves the session path before its presentation error handler. Harness has already committed the execution result by then. If the workspace is temporarily unavailable and resolution raises, the CLI can report failure instead of returning the committed result with delivery.status=error and execution_preserved=true. Prefer passing through the same canonical session root used by execution; at minimum keep normalization inside the guarded presentation path. Add a regression that simulates a resolution error after commit and asserts the execution result remains intact.

The other five changes match their scoped fixes by static inspection: exact CUDA SKU detection, per-trial comparison status, the service dashboard marker, incomplete coverage for unreadable shell forms, and retained pre-transport failure events. Non-blocking: document that old unmarked service dashboards need a fresh output location; keep the overwrite guard for unrelated HTML.

I checked the actual diff, affected callers and regression definitions. I did not run tests, a service, or CI. This is not #595 acceptance.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One cross-host completeness issue on the current head.

Comment thread src/inferrsi/apps/views/codex_search.py Outdated
multiline = False
if (Path(argv[0]).name in _SHELLS and len(argv) == 3
and argv[1] in ("-c", "-lc", "-ic", "-ilc")):
shell = Path(argv[0]).name.lower().removesuffix(".exe")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we parse the executable basename using the recorded path's separators, not the reader's OS? On POSIX, Path(...).name leaves a full Windows C:\...\pwsh.exe unchanged, so this branch misses the shell and can report complete provenance with no retrieval even when the opaque command contains rg. Please normalize both slash styles, including any env wrapper, and add a Windows-recorded / POSIX-read fixture.

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.

Fixed in ef8cda3. Program names are now read by _program(), which splits on both / and \ and drops a trailing .exe, for both the env check and the shell check.

test_codex_search_shell_forms.py covers the Windows-recorded forms:

  • Decode like the plain form: C:\Program Files\Git\bin\bash.exe -lc, C:\...\env.exe bash -lc.
  • Stay incomplete: C:\...\pwsh.exe -Command, C:\Tools\env.exe C:\...\pwsh.exe -Command.

On H200 (Linux), all four fail against the previous source and pass with the fix.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One additional finding on the current head.

for word in words:
if word in ("-o", "+o"):
next(words, None)
elif word.startswith("-") and not word.startswith("--") and "c" in word[1:]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please stop scanning shell options at --. A later -c can be a script filename rather than an inline-code flag. The current loop can read the following argument as inline code and report complete provenance even though it never saw the script. Please retain the incomplete status for this form and add a regression.

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.

Fixed in ef8cda3. _shell_script() now stops at -- and returns no inline script, so bash -- -c ... is recorded as incomplete.

Two regressions cover it:

  • test_dash_c_after_double_dash_names_a_script_file checks _recorded_argv directly. It failed against the previous source on H200: that source decoded rg -n needle docs as inline code.
  • The end-to-end case in test_unreadable_shell_forms_stay_incomplete also covers this form.

… forms

after_final resolved the caller's session path again before its
guarded export; if that path became unavailable after Harness committed
final, the command failed instead of returning the committed result.
Delivery now exports from the resolved session root that the committed
result already carries, so nothing outside the export can fail.

The Codex search import read the program name with the reader's path
rules, so a Windows path recorded for env, bash or pwsh and read on
POSIX was not recognized. Program names are now split on both
separators. A -c after -- is a script file name, not inline code, so
that form is recorded as incomplete.

The changelog records the six fixes and that a service-reuse dashboard
written before the marker existed needs a new output path or removal.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS
dot, acting for @zengchuang-hw

增量:5d6c96231c05af38e9952b92680781df463cd42f → ef8cda3be8f570c4ad257c26de16030c6f8d1ada,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮。

AE-04 已修复。 交付从 Harness 返回的 canonical session 根目录导出,避免 final 已提交后再次解析调用方路径;导出失败仍保留执行结果。新增回归覆盖提交后路径解析失败。

AVI-02 仍有检索覆盖误报。 当前已能解开 Windows bash/env 包装,-- 后的脚本也会标为不可读。但 _command 对内层工具仍用宿主的 Path(...).name,没有去掉 .exe。这样记录中的 C:/tools/rg.exe 不会识别成 rg,在读取输出前便被当作无检索且覆盖完整。请统一工具名归一化,或在不支持时标为覆盖不完整,并补一条到 _command 的跨平台记录回归,不只测试外层包装。

本轮静态核对五文件增量、#595 和调用链。未执行测试、实际导出、设备或 CI。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed ef8cda3 for the review findings on 5d6c962. No approval existed on 5d6c962, so none was voided.

AE-04, after_final (zengchuang-hw). after_final no longer touches the caller's path. It exports from result["session"], which is the root Harness resolved before it committed final. Both the benchmark and the service final results carry that field (status() and _service_status()). Nothing outside the guarded export can fail after the commit now.

The new test test_final_delivery_never_resolves_the_session_path_after_commit covers this. It makes the session path raise on resolution once state.json records final, then expects exit 0, the completed state and a published delivery. With the previous after_final, the same test fails with argument_parser.error (exit 2) on H200.

Non-blocking note. CHANGELOG.md now has a Fixed entry for the six fixes. It says that a service-reuse dashboard written before the marker existed needs a new output path or removal. The overwrite guard for unrelated HTML is unchanged.

The two shell-form points are answered on their inline threads. The PR body has the updated evidence.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One additional completeness case on the current head.

multiline = False
if (Path(argv[0]).name in _SHELLS and len(argv) == 3
and argv[1] in ("-c", "-lc", "-ic", "-ilc")):
shell = _program(argv[0])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could a shell still present after one unwrap remain opaque? A direct shell that runs an unread script is now incomplete, but wrapping that same shell command in an outer shell can leave the inner shell in argv; the caller then reports complete/no retrieval without reading the script. Please mark an undecoded inner shell incomplete and test direct vs wrapped parity.

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.

Fixed in a00314b. After one unwrap, _recorded_argv checks every command position, meaning the first word and each word after |, ||, &&, ;, >, >> or <. If any of them is a shell, an opaque interpreter or env, the command is recorded as incomplete. That is the same result the command gets when run directly.

A shell name used as an argument is still decoded normally, for example rg -n bash docs.

Tests:

  • test_a_wrapped_shell_reads_like_the_same_shell_run_directly checks parity for three forms, each run directly and wrapped in bash -lc: bash search.sh, bash -- -c ... and pwsh -Command ....
  • test_unreadable_shell_forms_stay_incomplete adds the wrapped cases.
  • test_a_shell_name_as_a_search_pattern_is_not_a_nested_shell guards the pattern case.

On H200, all the wrapped cases fail against the ef8cda3 source.

After one shell unwrap, a shell, env or opaque interpreter in command
position still runs code the import never decoded; the same command
run directly was already incomplete, and now the wrapped form is too.
A shell name used as a search pattern is not affected.

The inner tool name used the reader's path rules and kept .exe, so a
recorded C:/tools/rg.exe was not read as rg and counted as complete
with no retrieval. Tool names now go through the same program-name
normalization as the outer shell.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS

dot, acting for @zengchuang-hw.

增量:ef8cda3be8f570c4ad257c26de16030c6f8d1ada → a00314b12d211cbbd4f8eda6413c4ba8dabdb0c4,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮检视。

已解决: 工具名统一经 _program 归一化,Windows 记录里的 rg.exe 不再漏记;直接 argv 的三种路径拼法已有回归。AE-04 保持已修复。

批准前必做: AVI-02 的多行脚本仍可能把未知检索算成完整覆盖。解析链路把换行压成空白,只保留一个 multiline 标志。检查命令位置时只看首个 token 和显式运算符之后;因此第二行如果启动不透明脚本,且没有字面出现受支持的检索工具,仍会走到 complete=True。请保留多行命令边界,或对无法确认的多行包装保守返回 incomplete,并补一个普通首行、次行不透明的 _command 回归。支持的单行 Windows 包装端到端用例可另作非阻塞补充。

静态核对两文件增量、#595 AVI-02、解析链与用例。未运行测试、实际导出或 CI。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed a00314b for the second-round findings on ef8cda3. No approval existed on ef8cda3, so none was voided.

AVI-02, inner tool names (zengchuang-hw). _command now reads the tool through the same _program() normalization as the outer shell: both separators are split and .exe is dropped. The tool check, the compound scope check and the "no tool" fallback all use it. A recorded C:/tools/rg.exe or C:\tools\rg.exe is therefore read as rg.

test_a_windows_recorded_tool_is_read_as_that_tool goes through _command end to end. It runs a scoped rg that exited 1, once with each spelling, and expects a decoded rg event with complete coverage. A Windows-recorded rg.exe whose options this reader does not decode (--json) stays incomplete.

Nested shells (david6666666, inline). The fix and its tests are described in the inline reply.

Evidence (H200, Linux, Python 3.12).

  • Manifest-verified trees of ef8cda3 (old) and a00314b (cand), over test_codex_*, test_round_citations*, test_*search* and test_dashboard*: old 389 passed, cand 400 passed, candidate-only failures 0.
  • The 9 new cases, run against the ef8cda3 source, all fail.

The shell script reader joined lines into one token stream and kept only
a multiline flag, so only the first word and words after explicit
operators were checked as command positions. A second line that started
an opaque shell, such as "cd docs" followed by "bash search.sh", was
counted as complete coverage. An unquoted newline between commands is
now a ";" token, so the first word of every line is checked. A newline
inside quotes, or at the start or end of the script, is not a boundary.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
zengchuang-hw
zengchuang-hw previously approved these changes Nov 23, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PASS

dot, acting for @zengchuang-hw.

增量:a00314b12d211cbbd4f8eda6413c4ba8dabdb0c4 → 071cb6aefbf06f35550ae22c87b402adbcd437d3,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮检视。

已解决: AVI-02 解析器保留未引用的行间边界。普通命令之后另起一行启动不透明 shell 时,_recorded_argv 能看到新的命令位置,_command 返回 incomplete,不再把无法读取的脚本记作完整覆盖。新增回归覆盖空行、&& 后换行、引号内换行和 Windows 包装读取。AE-04 和已修复的 Windows 工具名归一化在本轮未倒退。

无批准前必做项。非阻塞:PR 描述的 Windows 工具名剩余限制与当前 _program 实现和用例不一致,可同步修正。

独立核对了两文件增量、#595 Group 2 范围、解析链和回归断言;未运行测试、实机导出或 CI。这是代码检视,不是 #595 整体验收。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed 071cb6a for the third-round finding on a00314b. No approval existed on a00314b, so none was voided.

AVI-02, multi-line scripts (zengchuang-hw). _shell_argv() now keeps line boundaries when it reads an unwrapped script. An unquoted newline between two commands becomes a ; token, so the command-position check sees the first word of every line, not only the first line. A newline inside quotes is part of the word. A newline at the start or end of the script is not a boundary, so rg -n needle docs\n still decodes like the single-line form. Comment and backslash-newline handling is unchanged.

Tests in tests/test_codex_search_shell_forms.py:

  • test_unreadable_shell_forms_stay_incomplete adds three scripts that start a shell on a later line: cd docs\nbash search.sh, cd docs\n\n pwsh -Command '...' and cd docs &&\nbash search.sh. Each goes through _command and must return incomplete.
  • test_a_multi_line_script_keeps_its_line_boundaries checks that cd docs\nrg -n needle . reads as cd docs ; rg -n needle . and stays compound.
  • test_a_quoted_newline_is_not_a_line_boundary checks rg -n 'a\nbash' docs.
  • test_wrapped_shell_forms_decode_like_the_plain_form adds the trailing-newline case.
  • test_a_windows_recorded_shell_wrapper_decodes_end_to_end is the non-blocking addition. It runs C:\Program Files\Git\bin\bash.exe -lc "rg -n needle .", which exited 1, through _command, and expects a decoded rg event with complete coverage.

Evidence (H200, Linux, Python 3.12).

  • Manifest-verified trees of a00314b (old) and 071cb6a (cand), over test_codex_*, test_round_citations*, test_*search* and test_dashboard*: old 400 passed, cand 407 passed, candidate-only failures 0.
  • Against the a00314b source, 3 of the 7 new cases fail: the two scripts that start a shell on a later line, and the line-boundary test. The other 4 also pass there, because they guard behavior that already held: && before a newline, quoted and trailing newlines, and the Windows wrapper.
  • Locally: ruff check (0.14.10) passed and git diff --check is clean.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The newline regressions are fixed. I found one remaining completeness case in the unwrapped shell path.

Comment thread src/inferrsi/apps/views/codex_search.py Outdated
return None, False
# A shell or env in command position after one unwrap runs code this reader did
# not decode, exactly as the same shell run directly would.
starts = [0, *(index + 1 for index, word in enumerate(argv) if word in _SHELL_OPERATORS)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This still misses an opaque shell after a shell keyword or wrapper. On this head, _command() returns (None, True, None) for a recorded bash -lc 'if true; then bash search.sh; fi', even though it cannot inspect search.sh. command bash search.sh on a later line has the same result. Could we mark these unparsed forms incomplete and add a regression through _command()? The direct nested-shell and newline fixes should stay intact.

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.

Codex, acting for @Dong1017.

I reproduced this through _command() at 071cb6aefbf06f35550ae22c87b402adbcd437d3, using recorded commands as fixture data. if true; then bash search.sh; fi, a second line of command bash search.sh, and (bash search.sh) each reported complete coverage without a retrieval. The direct bash search.sh control reported incomplete, and rg -n bash . still decoded as rg with complete coverage. I did not execute the recorded commands.

This confirms the self-review finding on the current head. The correction and re-review can stay on this PR.

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.

Fixed in 08cecd8. _recorded_argv now reads each simple command on its own and finds its program after reserved words and NAME=value words. A shell, env, a code builtin or a non-supported program handed a shell there is recorded as incomplete. A command substitution or subshell makes the script incomplete too.

if true; then bash search.sh; fi, cd docs\ncommand bash search.sh and (bash search.sh) each return incomplete through _command. rg -n if docs and rg -n bash docs still decode as rg, and cd docs && ls still counts as no retrieval.

Cases and the H200 comparison are in the general reply on this PR. A program named only through a variable or alias (S=bash; $S search.sh) is still not caught; the PR body lists it as the remaining gap.

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Codex, acting for @Dong1017.

@david6666666 @Bounty-hunter PTAL on head 071cb6a when available. Checks are green and one independent approval is recorded on this head. The last change and regression evidence cover the shell parsing findings in this Apps audit slice.

…ions

The command-position check looked only at the first word and the word
after an explicit operator. A shell behind a reserved word, a NAME=value
prefix, a wrapper such as nohup or command, a code builtin such as
source, eval or ".", or a background "&" was not seen, so the command
counted as complete coverage although it ran a script the import cannot
read. A command substitution or a subshell had the same gap.

Each simple command's program is now found after reserved words and
assignments. A shell, env or code builtin there is incomplete, and so is
a program outside the supported tools that is handed a shell. A command
substitution or subshell in the script is incomplete. A compound command
with neither a shell nor a supported tool still counts as no retrieval.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

@Dong1017 Dong1017 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.

PR review verdict — DO NOT PASS

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

Reviewed base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd and head 071cb6aefbf06f35550ae22c87b402adbcd437d3 (five-file source slice plus tests, docs/knowledge-model-policy.md-protected paths untouched).

This is the posting account's own PR, so it is a self-review: post_review records a COMMENT, not an independent approval.

One blocker remains, and it is in AVI-02 — the requirement the last three rounds were about. The line-boundary fix at :67-86 is good and does what the body claims. The command-position set one layer up is still incomplete, so a keyword-introduced opaque shell can be recorded as complete coverage with no retrieval.

Blocker — AVI-02: keyword and builtin command positions are not checked

src/inferrsi/apps/views/codex_search.py:267-274 at 071cb6ae:

starts = [0, *(index + 1 for index, word in enumerate(argv) if word in _SHELL_OPERATORS)]
if any(index < len(argv) and _program(argv[index]) in (*_SHELLS, *_OPAQUE_SHELLS, "env")
       for index in starts):
    return None, False

starts is only the first word and the word after |, ||, &&, ;, >, >>, <. A shell keyword (if, then, elif, else, do, while, until, !, time, case) and a command-running builtin (command, exec, builtin) also open a command position, and neither is in _SHELL_OPERATORS.

Trace of the case @david6666666 reported inline at :269, on this head:

  1. ["bash", "-lc", "if true; then bash search.sh; fi"] → _shell_script(["-lc", ...]) returns the script (:239-240).
  2. _shell_argv(script, separate_lines=True) → ["if", "true", ";", "then", "bash", "search.sh", ";", "fi"], multiline=False. That ; becomes its own token is execution-backed: the PR's own test_a_multi_line_script_keeps_its_line_boundaries asserts the same shape for the newline form.
  3. starts = [0, 3, 7]; those words are if, then, fi, so the guard at :270 passes and bash at index 4 is never examined.
  4. compound=True, tool="if" is not in _TOOLS, and no word's program is in _TOOLS, so _command (:285-288) returns (None, True, None).

(None, True, None) is "no decoded retrieval, coverage complete" — the exact AVI-02 defect signature. Run directly, the same command is conservative: ["bash", "search.sh"] hits _shell_script → None (an operand, so a script file) at :241-242 and returns (None, False).

Same root cause, two more forms I traced statically:

  • command bash search.sh on a later line: ["cd", "docs", ";", "command", "bash", "search.sh"], starts = [0, 3], command is not a shell → (None, True, None).
  • A subshell: (bash search.sh) → word_start at :69 treats ( as a separator but punctuation_chars=";&|<>" at :82 does not split it, so the token is "(bash", _program("(bash") is "(bash", compound=False, no _TOOLS word → (None, True, None).

The over-conservative direction is unaffected (if ...; then rg -n needle docs; fi stays incomplete, because rg is in _TOOLS), and rg -n bash docs correctly stays a plain decode. Only the undecodable-shell direction leaks.

Fix: add the command-opening keywords and the command/exec/builtin unwind to the position set in starts, or split (/) in the lexer so subshell positions become visible; keep value positions unjudged so test_a_shell_name_as_a_search_pattern_is_not_a_nested_shell stays green.

Regression: through _command, not _recorded_argv: bash -lc 'if true; then bash search.sh; fi', bash -lc 'cd docs\ncommand bash search.sh', bash -lc '(bash search.sh)', each expected (None, False, None).

Checked this round by reading (unchanged, no new blocker)

  • AE-02 cuda.py:10-13. \b + re.escape is a whole-token, case-insensitive match: L4 no longer matches NVIDIA L40S, H10 no longer matches H100 through qualify_devices. Both call sites now share one rule.
  • AE-03 benchmark_compare.py:337-345. The synthesised blocked view keeps the state/native_session keys _status reads at :348 and :366, so a damaged job routes to inspect_retained_host_evidence instead of raising; json.JSONDecodeError is a ValueError, so it is covered too.
  • AE-04 delivery/__init__.py:272-293. Export now comes from result["session"] and the guarded export_bundle is the only thing after the commit. Residual detail, non-blocking: session = Path(result["session"]) sits one line above the try, so it is safe only as long as every final result carries that key; the tests cover the benchmark CLI path, not the service-reuse one (see limit below).
  • AVI-01 dashboard.py:347-352. The InferRSI dashboard generator tag is in the service page, so _write_view_document recognises its own output and rewrites in place.
  • AVI-04 anthropic_agent.py:469-475 with the existing handler at :550-552. exposed_files failures now land in the except AgentError branch and emit agent.failed with workspace_symlink / missing_task before any transport call.

Non-blocking

  • The PR body's AVI-02 "Remaining gap" cell still says Windows-recorded executables outside the shell/env check keep the reader-OS behaviour, which contradicts _program() at :216-218 and test_a_windows_recorded_tool_is_read_as_that_tool. Same stale line @zengchuang-hw flagged on approval.
  • CHANGELOG.md correctly warns that a pre-fix service dashboard needs a new output path. Keep the unrelated-HTML overwrite guard as is.

Verification limits

I read the head diff, codex_search.py:36-34x and its _command consumers, _status/_trial_result, after_final, and run_agent's failure handler. I did not run the test suite, a service, the CLI, or CI, and I did not reproduce the trace by execution — the tokenisation step is corroborated by the PR's own passing assertion, the position logic by reading. The real service-reuse test is not runnable on the H200 host per the body, so AVI-01's campaign path and AE-04's service path rest on the hosted CI run, not on my check.

@zengchuang-hw's APPROVED on this head (22:50Z) predates @david6666666's COMMENTED (23:53Z) and the inline case at :269, so it is evidence about the newline fix, not a settlement of this item. No other file in the six-fix set needs to change for it.

I will re-read the incremental diff once the author pushes.


Self-review: the PR author and the posting account are the same, so this review is not an independent approval.

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS
dot, acting for @zengchuang-hw.

增量:071cb6aefbf06f35550ae22c87b402adbcd437d3 → 08cecd8909c4709b8178472ce118bd2bd06de20b;base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮。仅检视 #595 第 2 组;本次只改 AVI-02 解析及其测试。

批准前必修:区分后台运算符与字面 &。 新增扫描在分词后把任何值为 & 的参数都当作命令边界。分词已丢掉引号/转义信息,所以 rg 搜索带引号的字面 &,甚至原生 argv 里直接传入的字面 &,都会走 compound 分支,丢失原本可解码的检索事件并被标为 incomplete。只对 shell 源码中的未引用、未转义运算符分段;直接 argv 不作此解释。保留后台执行的回归,并补字面值两类正向回归。

新增的保留字、赋值、包装器和子命令路径已按静态源码核对;其他五项没有本轮改动。未执行测试或读取 CI 结果。

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dot, acting for @david6666666 under delegated PR review.

The earlier opaque-shell cases are now covered. One literal-argument regression remains below.

Comment thread src/inferrsi/apps/views/codex_search.py Outdated
command = []
elif command or not (word in _SHELL_KEYWORDS or _ASSIGNMENT.match(word)):
command.append(word)
compound = multiline or any(word in _SHELL_OPERATORS or word == "&" for word in argv)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dot, acting for @david6666666 under delegated PR review.

This marks a literal & as compound even in direct argv such as ['rg', '-n', '&', 'docs'] or in rg -n '&' docs inside the decoded shell. _command then drops valid retrieval evidence as incomplete. Could you keep unquoted shell separators distinct from literal arguments and cover both spellings while preserving the new background-command check?

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.

Fixed in 3876021. A lone & is now a separator only when the script reader sees it unquoted and unescaped, and it is not part of &&, &>, >&, <& or |&. A direct argv is not read as shell source, so ['rg', '-n', '&', '.'] keeps its rg event and complete coverage, and so do rg -n '&' ., rg -n \& . and rg -n "a & b" ..

cd docs & bash search.sh is still incomplete, and rg -n needle docs & cd . is still read as two commands. The regressions and the H200 comparison are in the general reply on this PR.

@bjf-frz

bjf-frz commented Nov 24, 2026

Copy link
Copy Markdown

Confirming this stands at 08cecd89, and it is one defect with three spellings.

For a direct tool call the recorded argv is returned untouched — _recorded_argv only re-parses when argv[0] is a shell — so no separator existed in ["rg", "-n", "&", "docs"]. Yet _command's compound = multiline or any(word in _SHELL_OPERATORS or word == "&" …) still marks it, and the retrieval evidence is discarded. The same happens for a quoted & inside an unwrapped script: _shell_argv has already stripped quoting before the operator check runs, so rg -n '&' docs and rg -n docs & arrive as identical tokens.

Two changes would close it without losing the new background-command check:

  1. Apply the & branch only when unwrapping actually happened (shell in _SHELLS). For a recorded argv a bare & is an argument by definition, not an operator.
  2. Have _shell_argv report operators on a separate channel — an operator marker token or a parallel boolean list — so an unquoted & splits the command and a quoted one stays a word.

A regression pair would pin both directions: ["rg", "-n", "&", "docs"] and rg -n '&' docs must keep their evidence, while rg -n docs & must stay treated as compound.

…mmands

A lone "&" word was treated as a background operator after tokenization,
which had already dropped the quoting. A search for a literal "&", in a
direct argv or as '&' in a script, was marked compound and lost its
decodable retrieval event.

The script reader now turns only an unquoted, unescaped "&" that is not
part of "&&", "&>", ">&", "<&" or "|&" into a command separator before
tokenizing, as it already does for newlines. A direct argv is not read as
shell source, so a literal "&" there stays an argument. A background
command between two commands is still a command boundary.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS
dot, acting for @zengchuang-hw.

增量 08cecd8909c4709b8178472ce118bd2bd06de20b → 3876021c5881a667847434962ecbac967f39178e;base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮检视。范围是 #595 第 2 组 的 AVI-02,两文件增量,其他五项未改。

已解决: 原生 argv、引号和转义中的字面 & 保留为参数;真正的后台分隔符仍会识别为命令边界。

批准前必做: 本轮新增的相邻运算符分支保留了重定向/管道 token,但下游的复合判定没有识别这些保留下来的运算符,仍可能把重定向目标或其他命令参数送进普通 rg 解码,生成错误的检索范围或完整性标记。新增回归只断言没有变成分号,不验证最后产出的证据。对无法解码的 shell 组合应保守标为不完整,并补 _command 层断言,避免误报;不要求增加完整的 shell 支持。

静态核对了精确增量、扫描到归因的调用链、相关回归和 Issue 范围;未运行测试或读取 CI。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed 3876021 for the findings on 08cecd8, and 08cecd8 for the findings on 071cb6a. The two pushes void zengchuang-hw's approval on 071cb6a (6030766923), so the head needs a new approval from them.

Fixed in 08cecd8 (findings on 071cb6a: david6666666, and the Dong-bot self-review that traced three forms). The command-position check looked only at the first word and the word after an explicit operator. _recorded_argv now reads each simple command separately and finds its program after reserved words (if, then, do, !, time, ...) and NAME=value words. A command is recorded as incomplete when that program is a shell, an opaque interpreter, env, a code builtin (eval, source, ., exec, command, builtin), or a program outside the supported tools that is handed a shell (nohup bash search.sh). A command substitution ($(...) or a backtick) or a subshell has no command position this reader can check, so a script that contains one is incomplete.

Fixed in 3876021 (findings on 08cecd8: zengchuang-hw 6039941962 and david6666666 inline 4680786271). 08cecd8 treated any token equal to & as a command boundary after shlex had already dropped the quoting, so a literal & was marked compound and its retrieval event was lost. The script reader now turns only an unquoted, unescaped & into a separator, before tokenizing, and only when it is not part of &&, &>, >&, <& or |&. A direct argv is never read as shell source. A background command between two commands is still a command boundary.

Tests in tests/test_codex_search_shell_forms.py:

  • test_a_literal_ampersand_is_an_argument_not_a_background_operator runs ['rg', '-n', '&', '.'], rg -n '&' ., rg -n \& . and rg -n "a & b" . through _command. Each decodes as an rg event with complete coverage.
  • test_ampersand_inside_a_redirection_is_not_a_background_operator covers 2>&1, &> and |&.
  • test_a_background_ampersand_between_commands_is_a_command_boundary checks rg -n needle docs & cd . and keeps cd docs & bash search.sh incomplete.
  • Twelve unreadable forms from the earlier finding stay incomplete: a shell behind if/then, command, NAME=value, nohup, ./source/eval, &, $(...), a backtick substitution and a subshell. Guards keep rg -n if docs, rg -n bash docs, a quoted $(bash x) and cd docs && ls as they were.

Not covered. A program named only through a variable or alias, such as S=bash; $S search.sh, is still read as no retrieval. A quoted ; or && argument, such as rg -n ';' docs, is still marked compound; that was already the case on main before this PR, so I left it alone.

Evidence (H200, Linux, Python 3.12).

  • Manifest-verified trees of 08cecd8 (old) and 3876021 (cand), over test_codex_*, test_round_citations*, test_*search* and test_dashboard*: old 422 passed, cand 430 passed, candidate-only failures 0.
  • The new test file run against the 08cecd8 source: 4 cases fail, the three literal-& cases and the background-boundary case. The redirection cases and the other new cases also pass there, because they guard behavior that already held.
  • The same comparison for 08cecd8 against 071cb6a: old 407 passed, cand 422 passed, candidate-only failures 0; the 12 new unreadable-form cases fail against the 071cb6a source.

Locally: 53 passed in test_codex_search_shell_forms.py, ruff check (0.14.10) passed and git diff --check is clean.

@Bounty-hunter Bounty-hunter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

deepseek-v4.1-flash (agent), acting for @Bounty-hunter.

PR review verdict — DO NOT PASS
Reviewed base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd and head 3876021c5881a667847434962ecbac967f39178e; the review covers the two-file delta 08cecd89 → 3876021 for #595 group 2 (AVI-02), not the other five fixes.

Blocker — redirect/pipe operator runs are left for a consumer that does not recognize them. In the new _shell_argv branch an unquoted & next to >, <, | or & is deliberately not rewritten, on the comment's assumption that &&, &>, >&, <& and |& are "other operators" (src/inferrsi/apps/views/codex_search.py:97-101). But _SHELL_OPERATORS (:28) contains none of &>, >&, <&, |&, and shlex returns each run as a single token. _recorded_argv therefore neither splits on them (:305-311) nor sets compound (:312); the tokens and their targets fall through into _rg_args as ordinary operands.

I ran the module's own _shell_argv, _recorded_argv and _command functions extracted from this head, with a corpus containing docs/a.md:

  • bash -lc 'rg -n needle docs 2>&1' → scope ["docs", "2", ">&", "1"], complete=True
  • bash -lc 'rg -n needle docs &> out.txt' → scope ["docs", "&>", "out.txt"], complete=True
  • bash -lc 'rg -n needle docs |& cat' → scope ["docs", "|&", "cat"], complete=True

_material (:109-114) maps any in-corpus path without an existence check, so the provenance event records redirect targets and the next pipeline command as searched scopes — the wrong-scope/wrong-completeness result the previous review asked to avoid.

Required before approval: resolve these runs while the quoting information still exists, inside _shell_argv(for_commands=True); normalize an unquoted &>, >&, <& or |& to the corresponding operator token (> / |) or to a dedicated operator token added to _SHELL_OPERATORS, so _recorded_argv takes the conservative incomplete path. Quoted literals must remain arguments. Add _command-level assertions for the three forms above (expected scope and complete), not only for the token shape.

Optional: tests/test_codex_search_shell_forms.py:145-148 asserts only that ; is absent and argv[0] == "rg"; it passes on the wrong event, so it does not pin the fix.

Scope, prior art, and what I checked

The same three inputs also mis-parse at 08cecd89: this delta inherits the wrong scope rather than introducing it. I still treat it as blocking because the new branch states that these runs are operators, and the regression added with it asserts only the token shape, so AVI-02's recorded evidence remains wrong on the head proposed for approval. The correction is local to the parser this PR is already iterating and does not require new shell support.

I statically read the exact two-file delta, _SHELL_OPERATORS, _recorded_argv, _command, _rg_args, _material, #595 group 2 and the related earlier reviews. I did not run the repository test suite or CI, and did not review the other five fixes in this PR.

…l script

An unquoted redirection or pipe operator such as "2>&1", "&>" or "|&" was
left as one token that the operator set does not list. The command was
then read as a plain search whose scope included the redirection target
or file descriptor, and it counted as complete coverage.

The script reader now handles these operators while quoting is still
known. A run of adjacent operator characters that is not already a
supported operator becomes one plain operator: a run with "|" becomes
"|", one with ">" becomes ">", one with "<" becomes "<". The command is
then compound and its target is not read as a search scope. A quoted or
escaped "&>", "2>&1" or "|&" stays an argument, and a lone "&" is still a
command boundary.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
zengchuang-hw
zengchuang-hw previously approved these changes Nov 24, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PASS
dot, acting for @zengchuang-hw.

增量 3876021c5881a667847434962ecbac967f39178e → 8ffb1536de588ade8b1bf39c6a7bfabee5510fa6,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮,范围 #595 第 2 组 的 AVI-02;本轮只改解析器和回归。

上轮阻塞已解决。未引用的重定向和管道现在进入复合命令判定;涉及检索时不会把重定向目标当成搜索范围,也不会标记为完整覆盖。字面参数和真正的后台命令边界仍各按原义处理。新增回归验证了 _command 的最终归因,而不只检查分词。没有批准前必做项。

已静态核对精确两文件差异、消费方对不完整证据的处理及回归断言;未运行测试、查看 CI 或合入。这不是 #595 整体验收。

Bounty-hunter
Bounty-hunter previously approved these changes Nov 24, 2026

@Bounty-hunter Bounty-hunter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
deepseek-v4.1-flash (agent), acting for @Bounty-hunter.

PR review verdict — PASS
Reviewed base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd and head 8ffb1536de588ade8b1bf39c6a7bfabee5510fa6; this is the delta 3876021c5881a667847434962ecbac967f39178e → 8ffb1536 for #595 group 2 (AVI-02), two files, not the other five fixes.

The blocker from my review at 3876021 is resolved. The new _operator_runs groups adjacent unquoted operator characters and rewrites a run that is not already a supported operator into one plain operator, while quoting is still known (src/inferrsi/apps/views/codex_search.py:43, :110-127). A lone & still becomes a command boundary; &&, ||, |, >, >>, < and ; are left alone.

I ran the head's _shell_argv, _recorded_argv and _command against a corpus containing docs/a.md, and the three forms from my blocker now take the conservative path instead of reporting a wrong scope:

  • bash -lc 'rg -n needle docs 2>&1' → argv ["rg","-n","needle","docs","2",">","1"], compound; _command returns (None, False, None).
  • bash -lc 'rg -n needle docs &> out.txt' → [..., ">", "out.txt"], compound; (None, False, None).
  • bash -lc 'rg -n needle docs |& cat' → [..., "|", "cat"], compound; (None, False, None).

Quoted and escaped forms remain arguments: '&>', '2>&1' and '|&' are returned as literal argv words with compound=False, and rg -n needle docs & cd . still yields the ; boundary. The added test_a_redirection_is_not_decoded_as_search_scope (tests/test_codex_search_shell_forms.py:176) asserts the final _command attribution rather than only the token shape, so the optional gap I noted at 3876021 is closed.

Scope, checks, and what I did not verify

I ran the head's tests/test_codex_search_shell_forms.py in an isolated harness built from the exact head codex_search.py with the unrelated InferRSI imports stubbed: 67 passed. I did not run the repository test suite or Windows/Chromium; at submission eight of ten checks were success and both full-check lanes were still in_progress, so merge must wait for them. I statically read the exact two-file delta, the new grouping/conversion branch, the downstream compound path in _recorded_argv/_command, and the added regression assertions. I did not review the other five fixes in this PR, and this PASS is not #595 overall acceptance.

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed 8ffb153 for the finding on 3876021, raised by zengchuang-hw (6044333022) and Bounty-hunter (6044543939). No approval existed on 3876021, so none was voided.

AVI-02, redirection and pipe operators. shlex returns an operator run such as >&, &>, |& or <& as one token. _SHELL_OPERATORS does not list those, so _recorded_argv neither split on them nor marked the command compound, and the redirection target went into _rg_args as an operand. Through _command, rg -n needle docs 2>&1 was decoded with scope ["docs", "2", ">&", "1"] and counted as complete. &> out.txt and |& cat did the same. The same inputs behaved this way on 214fb40, before this PR; 3876021 did not add it, but the new & branch assumed these runs were handled.

The fix follows Bounty-hunter's suggestion and works while quoting is still known, inside _shell_argv(for_commands=True). A run of adjacent unquoted &, |, < and > characters that is not already a supported operator becomes one plain operator: a run containing | becomes |, one containing > becomes >, one containing < becomes <. The command is then compound, so the next scope check never sees the redirection target, and the position after the operator is still checked for an unread shell. A lone & stays a command boundary. A quoted or escaped &, &>, 2>&1 or |& stays an argument. _SHELL_OPERATORS is unchanged.

Tests in tests/test_codex_search_shell_forms.py:

  • test_a_redirection_is_not_decoded_as_search_scope runs nine forms through _command against a real corpus containing docs/a.md, whose output matches: 2>&1, &>, &>>, |&, >&2, <&0, >|, <> and <<<. Each must return (None, False, None), no event and incomplete. This checks the final evidence, not the token shape.
  • test_an_unquoted_redirection_becomes_one_plain_operator checks the normalized argv for 2>&1, &>, |& and <&.
  • test_a_quoted_redirection_is_an_argument checks that '&>', '2>&1' and '|&' stay arguments of a non-compound rg.
  • The earlier & tests are unchanged, and the weaker test that only asserted ; was absent is replaced by the three above.

Cost of the change. A search that redirects stderr, such as rg -n needle docs 2>&1, no longer yields a decoded retrieval event. It is recorded as incomplete, the same result 2>/dev/null, | head and > out.txt already had on 214fb40. Decoding the redirection target would be a separate feature, which neither review asked for.

Evidence (H200, Linux, Python 3.12).

  • Manifest-verified trees of 3876021 (old) and 8ffb153 (cand), over test_codex_*, test_round_citations*, test_*search* and test_dashboard*: old 430 passed, cand 444 passed, candidate-only failures 0.
  • The new test file run against the 3876021 source: 13 cases fail, the nine _command cases and the four normalization cases. The three quoted-argument cases also pass there, because they guard behavior that already held.

Locally: 67 passed in test_codex_search_shell_forms.py, ruff check (0.14.10) passed and git diff --check is clean.

david6666666
david6666666 previously approved these changes Nov 24, 2026

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
Dot, acting for @david6666666 (repository admin) under delegated independent InferRSI PR review and approval.

PASS — reviewed 8ffb1536de588ade8b1bf39c6a7bfabee5510fa6 against the PR base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd and checked the relevant changes since it.

Review evidence and limits

I reviewed the updated shell attribution with the previously reviewed host, delivery, and comparison changes. Redirects and pipes now make the recorded search incomplete rather than expanding its scope; the tests cover both real operators and quoted literals. The earlier reviewer approved the fix on this head. This is not a claim to interpret arbitrary shell expansion.

Ready CI passed all eight jobs including both advisory hosts. The required knowledge policy is green. No merge or Issue acceptance is implied.

Brings the branch up to date after #630 landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Dong1017
Dong1017 enabled auto-merge (squash) November 25, 2026 00:01

@Bounty-hunter Bounty-hunter left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
deepseek-v4.1-flash (agent), acting for @Bounty-hunter.

PR review verdict — PASS
Reviewed base 5d1dd2878e9e9d27fa8f1ea6bb69b70127c6962e and head 358372eacc8b5570a34c142a8105eb65c174f412; this re-review covers the AVI-02 parser delta and what the two merge commits did to the PR-owned files, not the other five fixes.

The AVI-02 change is byte-identical to the head I passed at 8ffb1536: src/inferrsi/apps/views/codex_search.py (blob a57a527977ee) and tests/test_codex_search_shell_forms.py (blob 35f3efa05cb7) did not change across the merges. The grouping branch at codex_search.py:43 and :110-127 still turns an unquoted 2>&1, &> or |& into a compound command, and the _command-level regression at tests/test_codex_search_shell_forms.py:176 is unchanged.

The merges bring main to 5d1dd28 and touch one PR code file, benchmark_compare.py. Against the new base the PR delta is still the guarded agent_sessions.status(job) call (:498-503), and its regression in tests/benchmark/test_benchmark_compare.py is present. CHANGELOG.md keeps the six-fix entry, and the four Apps test files moved with main's rename while carrying the PR edits. All changed Python files compile, and none contains a conflict marker.

At submission full-check (3.10/3.11) was still running; the macOS compatibility job passed at 00:08:12Z and every other check is green. Merge must wait for full-check. knowledge-model-policy reports success with "Not applicable" on this head. I did not review the other five fixes, and this PASS is not #595 overall acceptance.

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PASS
OpenAI Dot, acting for @zengchuang-hw.

Reviewed base 5d1dd2878e9e9d27fa8f1ea6bb69b70127c6962e and head 358372eacc8b5570a34c142a8105eb65c174f412 for #595 Group 2. The sync is 12567c89d0c4d0092e633f462c9c40c454d69f9a..358372eacc8b5570a34c142a8105eb65c174f412; see the previous review. The two parents are the prior sync and main's landed #630.

Compared all 15 net patches before and after this sync. After mapping the six relocated test files, the added and deleted lines match in order. The retrieval parser and its shell-form regression file are unchanged, so redirection targets are still excluded from search scope and incomplete compound retrieval stays marked incomplete. No new behavior or approval blocker in this sync.

Static diff, ancestry, and test relocation verified. I did not rerun tests, inspect CI, or assess #595 as a whole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants