Skip to content

feat(analysis-view): project rich captures from an Evidence file and template path pairs - #5293

Merged
gensokyo-dev merged 13 commits into
morluto:mainfrom
earakely-scale:feat/analysis-view-rich-captures
Oct 20, 2026
Merged

gensokyo-dev merged 13 commits into
morluto:mainfrom
earakely-scale:feat/analysis-view-rich-captures

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Allow realistic captures to become environment manifests without sending the complete Evidence inline. inspect_analysis_view accepts an authenticated local evidence-file source; the opt-in sibling-pair-variance rule groups owner/repository paths only when a shared literal follows the pair. Trailing profile sub-resources remain separate tools.

Refs #4933. This extends existing read-only analysis of caller-selected local Evidence. It adds no provider, target execution, network request, mutation, or transport default change.

Changes

  • Read and authenticate Evidence within the request's cancellation and artifact-resource scope, with file-reader and authentication heap checks. CLI resolves relative paths; MCP requires an absolute path.
  • Keep file authentication at the file-source boundary. Invalid file contents return EvidenceFileError with the selected path and file-relative content_issues, rather than fictional source.path.<field> request locations.
  • Apply pair templating before single-segment inference and preserve namespace/name roles. The rule remains an opt-in inference, not proof of handler identity.
  • Keep the 96 MiB projection budget. Retained/file scenario sources reserve validation scratch and derived request text without charging borrowed response strings as inline input. Inline admission is unchanged.

Validation

  • 16 relevant source files / 298 tests passed; 5 compiled CLI/MCP and downstream environment boundary files / 48 tests passed.
  • Serial static/build/artifact gate: 11 tasks passed. Docs/catalog checks: 8 tasks passed. Architecture guards passed.
  • Real Gitea 28.2.0 + Chromium: 9 transactions, 45 events, zero drops, 12.6 MB capture. Inline refused within the unchanged budget; file CLI and default stdio MCP agreed on 5 tools, including separate trailing profile sub-resources. HTTP SDK checked 6 complete small responses and 12 correctly flagged 256 KiB large-response prefixes.
  • One CPU / one worker; sampled peak process-family RSS: source tests 765 MiB, boundaries 1,795 MiB, static/build 4,677 MiB, real application workflow 2,146 MiB. No OOM. Model token usage unmeasured; detailed timing and limits in the verification document.

Original macOS/Gitea/model-task experiments and their limitations are recorded in verification.md. In particular, the author's 63-tool / 12-task run predates the trailing-pair guard and is not evidence of the final guard's tool count. Current follow-up does not claim new macOS/Windows runtime or model-task verification.

Author readiness

Human owner: @earakely-scale

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

earakely-scale and others added 2 commits October 19, 2026 11:50
…template path pairs

inspect_analysis_view accepts a source {kind: "evidence-file", path},
read through the shared JSON file reader, authenticated as complete
Evidence and projected like retained Evidence. A capture is then bounded
by the file reader instead of being charged as inline input at 14 bytes
per string character, which refused a 10.7 MB capture whose response
bodies the environment manifest never reads.

The environment-manifest view gains the opt-in rule sibling-pair-variance:
groups that differ only in two adjacent literals after a plural literal,
such as /repos/{owner}/{repo}/issues, merge when at least three distinct
pairs vary in both positions. Their parameters are named <singular>_namespace
and <singular>_name. A rich Gitea capture otherwise produced one tool per
repository, beyond the 128 tools model providers accept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@earakely-scale
earakely-scale marked this pull request as ready for review October 19, 2026 19:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T02:28:58.011057Z 4b77f01 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 081465859d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/server/registerAnalysisViewTool.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no new blocking issue was found.

Summary

Adds Evidence-file sources for analysis views and an opt-in rule for merging adjacent path segments. Since the previous review, file authentication moved into the reader, and malformed files now report the selected path with file-relative content_issues.

  • Analysis views can use a local Evidence file as their source.
  • Environment manifests can template routes that vary in two adjacent segments.
  • Scenario-capture projections budget the text they derive from a capture.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[CLI or MCP request] --> B{Source}
  B -->|Evidence file| C[Read with cancellation and resource ownership]
  C --> D[Check heap space]
  D --> E[Authenticate Evidence]
  E --> F[Check cancellation]
  F --> G[Project as retained Evidence]
  B -->|Inline or retained| G
  G --> H[Check cancellation for file requests]
  H --> I[Return view or typed error]
Loading

Reviews (9) · Last reviewed commit: "fix(analysis-view): locate Evidence file..." · Reviewed by Greptile

Comment thread src/server/registerAnalysisViewTool.ts Resolved
…merge pairs first

Evidence-file reads now take the MCP request's signal and the server's
artifact resource scope: a cancelled request returns typed cancellation
before authentication, before projection or after projection and records
nothing, and a failed descriptor close stays owned for retry. Before
authentication copies and hashes the parsed Evidence, REA checks that live
heap headroom holds those copies and otherwise returns resource_constraint.

sibling-pair-variance now runs before sibling-variance, so a single-position
merge cannot template one half of a pair and leave too few literal pairs;
with both rules the pair still merges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a89e15ac11

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

earakely-scale and others added 2 commits October 19, 2026 13:16
… pair roles

Authentication and projection of a file source run synchronously, so the
service now yields to the event loop before each cancellation check; an
abort that arrives while they run is dispatched and the request returns
typed cancellation instead of a recorded result.

Each sibling-pair-variance parameter records whether it is the pair's
namespace or name when the pair forms, and merges keep that role, so a
later sibling-variance merge of the segment before the pair cannot rename
the first half as a second.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e77707ba51

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

earakely-scale and others added 2 commits October 19, 2026 16:14
Brings in the environment export (morluto#4999) and scenario capture (morluto#5182)
merges. The one conflict, the inspect_analysis_view contract text, keeps
both insertions: main's sentence on scenario parents and this branch's
evidence-file source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ncellation before auth failures

After main's scenario support, a capture_browser_scenario parent charged
every string at 14 bytes per character even when read from its file, so
the rich captures this change exists for (a 10.7 MB scenario of 1,218
reads) were refused again at the 96 MiB budget. Scenario admission now
reserves what projection actually derives, before validation: the
scratch of checking the largest body (two bytes per base64 character)
and the decoded text of every request body. Response bodies stay
borrowed, as HAR response text does; inline parents are still charged
per character by inline admission.

A file request aborted while its Evidence was being authenticated could
return the authentication failure; the cancellation check now precedes
it, so an aborted request reports typed cancellation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

The inspect_analysis_view contract text conflicted again; main's IL2CPP
wording and this branch's evidence-file sentence are both kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

…g derived text

The derived-text estimate parsed every event against one loose schema,
so a single body without content (not requested, unavailable or not
exposed) failed the parse and the whole estimate fell to zero, letting
large request bodies elsewhere decode without a reservation. Each event
is now read on its own, as own data members of the already admitted
parent, and a test with an uncaptured body beside a 2 MiB request body
is refused before any text is decoded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

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

Reviewed at e725fbd4. The evidence-file source is in good shape. I'd hold the merge for one change to sibling-pair-variance, plus a scope confirmation.

What I checked

  • CI is green, all 9 automated review threads are resolved with fixes, and the branch merges cleanly into main.
  • I ran the changed unit tests locally: environmentManifestView, scenarioCaptureRecords and src/application/analysisView/ (88 passed). I did not rerun the boundary tests or the Gitea capture.
  • evidence-file: the file is read through the shared readJsonFile and authenticated with parseEvidence. The new code checks for cancellation (with a yield) after the read, after authentication and after projection, and it uses the server's artifactResources scope. The view Evidence records only parent_evidence_id + view, so it is identical whether the parent came inline, retained or from a file, as the PR says. The synchronous API refuses the file source with a typed error. All of this looks right to me.
  • Scenario admission: the per-body derivedTextBytes estimate matches what browserNetworkBodySchema's superRefine actually allocates (it decodes and re-encodes one body at a time).

Should fix before merge: sibling-pair-variance merges distinct sub-resources (inline below)
The rule can't tell /{owner}/{repo} apart from /{id}/{sub-resource}. I ran a probe against this branch with ["sibling-pair-variance"]:

GET /api/v1/users/alice/followers
GET /api/v1/users/bob/following
GET /api/v1/users/carol/starred
→ one tool: /api/v1/users/{user_namespace}/{user_name}  (get_users_by_user_namespace_user_name, records [0,1,2])

Three different endpoints became one tool. A browser scenario that opens profile tabs (Gitea's own /users/{u}/repos, /starred, /followers, /following, /heatmap) will produce this, so it is likely in real captures. #4933 warned about exactly this kind of silent over-generalization. Possible guards: refuse a bucket when a value in the second position appears under two or more namespaces, or require a shared literal suffix after the pair. Either way, please add this case as a regression test. If you'd rather keep the heuristic as is, at least add it to the rule's documented limitations. It would also help to note in verification.md whether any of the 63 Gitea tools merged sub-resources this way. The 12/12 task score doesn't rule it out.

Nits (non-blocking)

  • An evidence-file whose JSON isn't valid Evidence reports schema issues under source.path.<evidence field> (inline below). That path points at the request's string field, not at the file's contents. A file-relative path, or an EvidenceFileError that carries the issues, would be clearer.
  • The pair loop starts at index 2, the same as sibling-variance. So an origin-rooted /repos/{owner}/{repo} (GitHub-style, plural at index 0) never qualifies. The docs state "index 2 or later", so this is consistent, just worth knowing.
  • Compatibility says the budget is unchanged. That holds for inline sources, but retained scenario parents are now charged less (derived text only, instead of 14 B/char). The validation notes explain this; a line under Compatibility would make it visible.

Merge readiness
The body says "scope decision requested there" (#4933), yet the scope box is ticked. #4933 has no maintainer reply on record. The sibling PRs (#4954, #4975, #4999, #5182) were merged by maintainers, so the direction looks accepted. Still, evidence-file adds a new MCP input that reads a caller-named local file, so a maintainer should confirm it explicitly. With the pair-rule fix and that confirmation, I'd consider this ready to merge.

…ariance

A pair that ends the route, such as /users/alice/followers,
/users/bob/following and /users/carol/starred, met every pair condition
and collapsed three endpoints into /users/{user_namespace}/{user_name}.
The second half of a trailing pair names a sub-resource rather than a
namespace and name, so a pair now qualifies only when another literal
follows it (/repos/{owner}/{repo}/issues). Bare /repos/{owner}/{repo}
detail routes stay one tool per pair.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

The only conflict was the inspect_analysis_view contract text: main's
Godot PCK additions are kept and the evidence-file source sentence is
re-inserted after the inline-source sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

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

Reviewed with Codex assistance at 4b77f01. The change stays within read-only inspection of caller-selected local Evidence. File access uses the existing regular-file reader, request cancellation and resource owner; authentication and schema locations now belong to the file boundary. Retained/file scenario admission reserves validation scratch and derived request text before allocation. Pair inference stays opt-in and requires a trailing shared literal, preserving profile sub-resources.

Validation executed on this tree: 298 relevant source tests, 48 compiled CLI/MCP/environment boundary tests, serial static/build and docs/catalog checks, architecture guards, plus actual Gitea 28.2.0/Chromium capture -> file CLI/default stdio MCP parity -> 18 checked HTTP replays (six complete responses; twelve correctly marked 256 KiB prefixes). No macOS/Windows runtime or new model-task scoring is claimed. The original human owner’s initial readiness declaration is retained.

@gensokyo-dev
gensokyo-dev merged commit f93a033 into morluto:main Oct 20, 2026
47 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
3 tasks done
kangyishuai pushed a commit to kangyishuai/rea that referenced this pull request Oct 20, 2026
…ansition-view

Resolve conflicts with main's evidence-file analysis-view source (morluto#5293).
Keep main's evidence-file sentence in the inspect_analysis_view
description together with this branch's capture_browser_scenario text.
Keep both the browser-scenario authority test and main's
inspectAnalysisViewWithFiles tests in AnalysisViewService.test.ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@morluto morluto added area: runtime Process capture and runtime observation enhancement New feature or request labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants