Skip to content

feat(views): support Antigravity transcript attribution in read_window - #992

Open
SamitHuang wants to merge 2 commits into
InferMatrixLab:mainfrom
SamitHuang:feat/antigravity-transcript-attribution
Open

SamitHuang wants to merge 2 commits into
InferMatrixLab:mainfrom
SamitHuang:feat/antigravity-transcript-attribution

Conversation

@SamitHuang

@SamitHuang SamitHuang commented Dec 3, 2026 •

Copy link
Copy Markdown

Governing Issue and delivery slice

Refs #991

  • Accepted scope / delegation: Proposed in RFC [RFC] Support Antigravity transcript attribution in views #991; initial implementation slice for Antigravity transcript attribution.
  • What this PR delivers:
    • src/inferrsi/apps/views/antigravity_search.py: Antigravity transcript.jsonl / transcript_full.jsonl reader supporting run_command, read_file, assistant PLANNER_RESPONSE.content decisions, trusted-cwd provenance enforcement (never defaults cwd to corpus), and truncation detection.
    • src/inferrsi/apps/views/codex_search.py: automatic dispatch in read_window when line 1 matches Antigravity's step-envelope schema.
    • tests/apps/test_antigravity_search.py: unit tests for absolute-path run_command and read_file (ranged), decision extraction, truncated-output uncertainty handling, and same-named workspace/corpus relative-path regression without trusted cwd.
    • docs/guides/plugins/antigravity-plugin.md: updated transcript attribution notes.
  • What it does not deliver: Automatic discovery of Antigravity brain directories outside explicitly passed trace paths, or Codex-specific round_citations submission-matching heuristics.
  • Anchors touched: none

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "606c8484ab5dcf18e12a2f47f5beb3dab626a874",
  "human_only": false,
  "material_ai_authors": [
    {
      "tool": "Antigravity",
      "model_id": "gemini-4-neon-low",
      "effort": "low",
      "role": "author"
    }
  ]
}

Changed artifacts and evidence

Requirement Actual change Check / evidence and result Remaining gap
Antigravity transcript reader & read_window dispatch src/inferrsi/apps/views/antigravity_search.py, src/inferrsi/apps/views/codex_search.py pytest tests/apps/test_antigravity_search.py tests/apps/test_antigravity_plugin.py tests/apps/test_codex_search_delivery.py (53 passed) Full CI suite pending
Trusted cwd provenance & same-named file regression src/inferrsi/apps/views/antigravity_search.py, tests/apps/test_antigravity_search.py test_antigravity_relative_reads_without_trusted_cwd_do_not_attribute_to_corpus passed none
Lint & formatting All changed files ruff check src tests tools (All checks passed) none
Plugin guide update docs/guides/plugins/antigravity-plugin.md Verified against test_antigravity_plugin.py none

Checks and dependencies

  • Checks actually run (result and tested scope):
    • ruff check src tests tools — passed.
    • pytest tests/apps/test_antigravity_search.py tests/apps/test_antigravity_plugin.py tests/apps/test_codex_search_delivery.py — 53 passed in 28.35s.
  • Failed, skipped, timed-out or not-run checks (if applicable):
    • Full pytest suite not run locally (will run in GitHub Actions CI).
  • Dependencies / shared interfaces / integration assumptions (if applicable):
    • Reuses codex_search._command, _delivery, _detail, and codex_tool_returns._output_lines without changing Codex rollout behavior.

Remaining work and Issue closure

Add an Antigravity transcript reader (antigravity_search.py) and
dispatch to it automatically from codex_search.read_window when the
trace starts with Antigravity's step-envelope JSONL schema.

- Pair PLANNER_RESPONSE tool calls with ordered GENERIC results for
  run_command and read_file, reusing existing corpus command/delivery
  attribution.
- Extract assistant decision text from PLANNER_RESPONSE.content.
- Mark truncated tool outputs as runtime_truncated and uncertain.
- Add unit tests and update the Antigravity plugin guide.

Agent-assisted-by: Antigravity / gemini-4-neon-low [effort=low] (author)
Signed-off-by: Samit <yhuangch@cse.ust.hk>
@SamitHuang

SamitHuang commented Dec 3, 2026 •

Copy link
Copy Markdown
Author

Low-cost E2E verification (live Antigravity transcript)

Verified codex_search.read_window(..., archive=True) end-to-end against a real, live Antigravity transcript.jsonl (89 lines) and the real src/inferrsi/knowledge/data/skill_library corpus.

  • Tested head: 01a72d193d255bba800c153142b89e3cd3332e0e
  • Real Antigravity operations exercised:
    1. read_file on <repo>/src/inferrsi/knowledge/data/skill_library/README.md (lines 1–15)
    2. run_command executing sed -n '1,5p' <repo>/src/inferrsi/knowledge/data/skill_library/README.md

Observed output (paths & conversation ID redacted)

total_lines=89
session_detected=True, archive=True
attributed_events=2
  - id=file-87 tool=sed action=read state=visible truncated=False return_line=87 visible_refs=['README.md']
  - id=file-88 tool=sed action=read state=visible truncated=False return_line=88 visible_refs=['README.md']
decisions_extracted=5
uncertain_lines_count=16
unresolved_details_count=6
E2E_PASS

Both read_file and run_command corpus reads were attributed with delivery.state == "visible" and visible_refs == ["README.md"], 5 assistant PLANNER_RESPONSE.content decisions were extracted, and compound/non-corpus/truncated commands remained conservatively in uncertain / unresolved_details.

@Dong1017 Dong1017 added the area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters label Dec 3, 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.

首次检视。Base ed143a77fd1aca61de011147fee748a5c7c38dd5,head 01a72d193d255bba800c153142b89e3cd3332e0e,范围 #991。

Antigravity 适配器给 read_file 合成的 command item 填了 cwd=str(corpus);共享身份解析会用该 cwd 解释相对路径。因此相对读取即使没有可信工作目录,也能被归到 corpus 中的材料。现有读取测试传的是绝对路径,没覆盖此分支。批准前,请仅使用转录提供的可信来源;缺失时标为 uncertain,补一个工作目录与 corpus 含同名文件的静态归属回归,并保留绝对路径正例。#991 的实现范围仍为 proposed。已静态追踪四文件 diff、两个 host 路径与适用技能;未独立重放实时 Antigravity 或 CI。

…aths

Never default synthesized command cwd to the target corpus path. Use a
working directory only when explicitly recorded in the transcript (or
derive a non-corpus root only when file operands are absolute), so
relative read_file and run_command calls without a trusted cwd are
marked uncertain instead of colliding with same-named corpus files.

Add a regression test where workspace and corpus contain same-named
files while preserving absolute-path positive coverage.

Agent-assisted-by: Antigravity / gemini-4-neon-low [effort=low] (author)
Signed-off-by: Samit <yhuangch@cse.ust.hk>
@SamitHuang

Copy link
Copy Markdown
Author

Addressed review feedback at head 606c8484ab5dcf18e12a2f47f5beb3dab626a874:

  • Removed the cwd=str(corpus) fallback in _parse_read_file and _parse_run_command. Both now use only a cwd explicitly recorded in the transcript (or a non-corpus root only when file operands are absolute), leaving relative reads/commands without trusted provenance unattributed and marked uncertain.
  • Added test_antigravity_relative_reads_without_trusted_cwd_do_not_attribute_to_corpus covering same-named files in workspace vs. corpus (without trusted cwd and with workspace cwd), while retaining the absolute-path positive test.
  • Updated RFC [RFC] Support Antigravity transcript attribution in views #991 with the trusted-provenance acceptance boundary and closed duplicate [RFC] Support Antigravity transcript attribution in views #990.
  • Local checks on 606c8484ab5dcf18e12a2f47f5beb3dab626a874: ruff check src tests tools passed; pytest tests/apps/test_antigravity_search.py tests/apps/test_antigravity_plugin.py tests/apps/test_codex_search_delivery.py — 53 passed.

Ready for re-review.

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

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

PR review verdict — PASS
Reviewed base ed143a7 and head 606c848 (first review on open; full diff, diffComplete true).

Prior reviews: no formal Approve on this head is seeded. @zengchuang-hw's COMMENTED review, on the earlier commit 01a72d1, raised one blocker: read_file synthesized command items set cwd to the corpus, so relative reads with no trusted working directory could be attributed to corpus material. No CHANGES_REQUESTED is outstanding. I checked that finding against 606c848:

  • src/inferrsi/apps/views/antigravity_search.py: _trusted_cwd accepts only an absolute recorded Cwd/cwd/workdir/WorkingDirectory. _parse_read_file falls back to the parent of an absolute Path only. Relative reads without a trusted cwd keep cwd=None. _parse_run_command uses / only when every file operand is absolute (_all_file_operands_absolute).
  • src/inferrsi/apps/views/codex_search.py L453-455: _command returns event None with complete False when cwd is None for cat/sed/nl/rg, so no corpus attribution happens and the item is marked uncertain.
  • tests/apps/test_antigravity_search.py: test_antigravity_relative_reads_without_trusted_cwd_do_not_attribute_to_corpus covers the same-named workspace/corpus case (events == [], uncertain [3, 4]). The absolute-path positive test test_antigravity_run_command_and_read_file_attribution remains.

Other checks:

  • codex_search.read_window dispatch (diff L878+) to the Antigravity reader is a function-local import, which avoids a circular import; the Antigravity reader imports codex_search lazily too.
  • Truncation handling (runtime_truncated, kept in uncertain) matches the wording in docs/guides/plugins/antigravity-plugin.md.

Not verified here:

  • Tests were not executed; CI status was not seen.
  • No live Antigravity transcript was replayed; the envelope assumptions (step_index, type, tool_calls, GENERIC pairing) follow the test fixtures.
  • I read only the current head, not the 01a72d1 to 606c848 delta, and did not read the rest of codex_search.read_window or the _delivery/capture paths.

Non-blocking follow-ups (not required for this PASS):

  • Tool calls are paired with result rows positionally (FIFO over GENERIC rows, no call ID). An interleaved non-GENERIC result within one planner step would shift the pairing. A test with a mixed step sequence would pin this down.
  • A read_file result without the "Showing lines" header, or a run_command result without the exit-code line, is skipped silently rather than marked in uncertain. Consider marking it.

@SamitHuang

Copy link
Copy Markdown
Author

@zengchuang-hw PTAL

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

回应本条 PTAL,从上轮 01a72d19到 606c8484ab5dcf18e12a2f47f5beb3dab626a874。上轮指出的 corpus 默认 cwd 已移除;相对路径只用显式工作目录,没有来源时不会把同名 corpus 文件补作归属。已独立验证当前 3 项 Antigravity CPU 测试,包含绝对路径和同名对照,均通过。

暂不批准的剩余项只有 #991 的交付范围未接受,须由负责人记录接受和验收人;不要用软件回归代替范围授权。本轮未取得真实宿主转录或运行宿主,不能把合成结果当真实会话回放。

Copy link
Copy Markdown
Collaborator

首次检视 PR #992。本次看的是 base ed143a77fd1aca61de011147fee748a5c7c38dd5 到 head 606c8484ab5dcf18e12a2f47f5beb3dab626a874 的完整 diff(两笔提交)。

上轮在 01a72d193d255bba800c153142b89e3cd3332e0e 指出的默认 cwd=str(corpus) 已不在当前 head:_trusted_cwd 只接受转录里显式记录的绝对工作目录;相对路径在没有可信 cwd 时保持 cwd=None,不会把同名 corpus 文件补作归属。对应回归 test_antigravity_relative_reads_without_trusted_cwd_do_not_attribute_to_corpus 也在,绝对路径正例仍保留。该 head 上 Ready(含 full-check 3.10/3.11)已经全绿。我未重跑测试,也未回放真实宿主转录。

暂不 Approve,原因与 @zengchuang-hw 在当前 head 上的 NO PASS 一致:治理 issue #991 仍是 status:proposed,尚未由具名目标验收人记录接受或推迟整个待定范围。软件回归和 CI 不能代替范围授权。在 #991 (comment) 之后,comment 7429119380 仍确认这一点。

在范围被接受之前,当前实现还有一处与待定验收项直接相关的行为:src/inferrsi/apps/views/antigravity_search.py 在配对失败、结果格式无法解析、或工具不是 run_command / read_file 时会直接 continue(约 229–241 行),不会把对应行标为 uncertain。请先在 #991 写明并接受这些规则(以及版本钉扎和截断判定),再按接受后的边界改实现并请求复核。本次不是 #991 的目标验收。

inferRSI, acting for @amy-why-3459.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants