Skip to content

feat(environment): render more read tools from the state and describe responses - #6162

Closed
morluto wants to merge 1 commit into
mainfrom
cursor/rebase-5352
Closed

morluto wants to merge 1 commit into
mainfrom
cursor/rebase-5352

Conversation

@morluto

@morluto morluto commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Replacement for fork PR #5352. GitHub Update-branch and a maintainer force-with-lease push to earakely-scale/rea feat/environment-state-coverage both failed (the app token cannot update .github/workflows/ci.yml). This is one squashed commit of that PR rebased onto current main.

Problem and expected behavior

#5352 was conflicting with main after #5351 landed environment serving. The branch should be mergeable again, with serving kept and the coverage work still present: non-entity reads held as documents, tool descriptions that summarize recorded responses, and MCP annotations for safe methods including OPTIONS and TRACE.

Change and scope

Started from origin/main, merged pull/5352/head, and resolved conflicts so #5351 serving stays and #5352's coverage, response descriptions, and annotations stay. Squashed to one commit. Not a provider, injection, or target-execution change. Contribution scope: ordinary environment-serving behavior within the existing serve boundary. Maintainer scope decision: not applicable.

Follow the contribution scope.

Contract and boundary impact

  • Semantic owner and earliest changed stage: environment state view and served tool catalog, at catalog construction and state extraction.
  • Contribution scope fit and linked maintainer decision: existing environment-serve behavior; not applicable.
  • CLI and MCP/tool-catalog contract: tool descriptions gain a bounded response summary; MCP tool annotations are advertised. Serving from the derived state is unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: state documents cover non-entity reads with one initial request line; item-shaped paths stay recorded.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none committed.

Expected effects (check known effects; use documentation-only on its own).

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: feat(environment): render more read tools from the state and describe responses #5352's environment tool, state-view, and serve tests, merged with main's serve tests.
  • Base reproduction or other evidence: source-derived conflict resolution. npm run typecheck passed on this tree.
  • User-visible CLI/MCP output (if applicable): tool descriptions include a response summary; annotations are registered on served tools.
  • Remaining proof gaps: the environment test suite was not executed in this rebase.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run typecheck — passed on the resolved tree before squash (same tree as this commit).

Compatibility, safety, and release

  • Breaking changes or migration steps: none intended. Serving, --replay-only, and the data plane stay as on main.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: captured catalog text stays untrusted content; annotations do not widen what the server executes.

Stack: this commit is the base of cursor/rebase-5600 (#5600 replacement) and cursor/rebase-5699 (#5699 replacement). Merging a later branch also brings this commit.

Author readiness

Human owner: @morluto

  • 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.
Open in Web Open in Cursor 

… responses

Keep main's environment serving and fold in coverage for non-entity reads,
response summaries, and MCP tool annotations.

Squashed rebase of #5352 onto main.
@morluto
morluto marked this pull request as ready for review October 21, 2026 21:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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 ✅ Completed 2026-10-21T21:36:38.444188Z 95c8c9d Draft marked ready
ℹ️ 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.

@morluto morluto closed this Oct 21, 2026

@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: 95c8c9d157

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const [member] = pointerTokens(pointer);
return member === undefined
? `a JSON array of objects ${withFields(items)}`
: `a JSON object whose ${describeText(member, "member", "capture Evidence", JSON.stringify)} lists objects ${withFields(items)}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the sample limit after JSON escaping

When a captured envelope member contains escapable characters, describeText checks the raw member against the 1 KiB budget before JSON.stringify expands it—for example, 1,024 NUL characters become more than 6 KiB. A capture with enough such tools can therefore inflate discovery context and exceed the 1 MiB catalog reservation even though every member ostensibly fits the sample limit; bound the rendered JSON string or truncate based on its encoded size instead.

AGENTS.md reference: AGENTS.md:L43-L47

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[Medium impact] The PR changes behavior within environment-state extraction and environment tool serving.

The PR appears safe to merge, with a non-blocking fix recommended for quoted wrapper-name budgets.

Fix All in CodexFindings

  1. P2 Quoted names exceed sample limits ▶
Fix with agent prompt
### Issue 1
src/application/environment/environmentTools.ts:93-97
`describeText` checks the sample size before calling `show`, but wrapper names now pass `JSON.stringify` as `show`. A name containing 1,024 null characters passes the 1,024-byte check and becomes 6,146 bytes when quoted. This exceeds the display budget and can make catalogs hit the discovery limit much earlier.

Apply the sample limit to the quoted text, and cover escaped names in the budget tests.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR expands state-backed reads and adds response summaries and MCP method hints.

  • Environment state captures more non-entity reads and recognizes more item identities.
  • Served tool descriptions summarize replayable responses and recorded statuses.
  • Served MCP tools advertise hints about their captured methods.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Capture[Retained capture] --> Source[Environment source]
  Manifest[Manifest] --> Source
  Source --> Classify[Shared body classification]
  Classify --> Summary[Bounded response descriptions]
  Source --> Extract[Extract entities and documents]
  Extract --> State[Held state and read plans]
  Summary --> Catalog[Tool catalog and MCP hints]
  Catalog --> MCP[MCP discovery]
  State --> Answer[State answer or recorded fallback]
  Classify --> Answer
Loading

Reviews (1) · Last reviewed commit: "feat(environment): render more read tool..." · Reviewed by Greptile

Comment on lines 93 to +97
if (
text.length <= DESCRIPTION_SAMPLE_BYTES &&
Buffer.byteLength(text, "utf8") <= DESCRIPTION_SAMPLE_BYTES
)
return text;
return show(text);

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.

P2 Quoted names exceed sample limits

describeText checks the sample size before calling show, but wrapper names now pass JSON.stringify as show. A name containing 1,024 null characters passes the 1,024-byte check and becomes 6,146 bytes when quoted. This exceeds the display budget and can make catalogs hit the discovery limit much earlier.

Apply the sample limit to the quoted text, and cover escaped names in the budget tests.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/application/environment/environmentTools.ts
Line: 93-97

Comment:
**Quoted names exceed sample limits**

`describeText` checks the sample size before calling `show`, but wrapper names now pass `JSON.stringify` as `show`. A name containing 1,024 null characters passes the 1,024-byte check and becomes 6,146 bytes when quoted. This exceeds the display budget and can make catalogs hit the discovery limit much earlier.

Apply the sample limit to the quoted text, and cover escaped names in the budget tests.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

@morluto morluto added the enhancement New feature or request label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants