Skip to content

fix(environment)!: attribute source errors to caller fields - #7900

Merged
morluto merged 3 commits into
mainfrom
codex/fix-environment-source-field
Oct 29, 2026
Merged

morluto merged 3 commits into
mainfrom
codex/fix-environment-source-field

Conversation

@morluto

@morluto morluto commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

export_environment_bundle reports source-file admission and JSON errors against an internal evidence role that is absent from its input schema. The shared reader now carries the caller's actual field path into those diagnostics.

Fixes #7523

Problem and expected behavior

A missing file, directory, invalid UTF-8 or malformed JSON selected through MCP source.path is correctly rejected, but the resulting issue points to ["evidence"] and may incorrectly claim inline JSON was supplied. It now points to ["source", "path"]. The related environment-build CLI consumer identifies capture rather than an internal role.

Change and scope

The environment file reader separates its internal manifest/Evidence role from optional caller-field context. Its existing size checks, reads and error categories remain in place. This is a read-only diagnostic correction; a maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: shared environment source-file admission and JSON parsing, consumed by bundle MCP and environment-build CLI.
  • Contribution scope fit and linked maintainer decision: existing workflow; not applicable.
  • CLI and MCP/tool-catalog contract: invalid-input field paths and the selected-file explanation change; input schemas and successful output do not.
  • Provider, bridge, target-format, or platform compatibility: none identified; tests ran on macOS.
  • Evidence, artifact, provenance, or reconstruction contract: selected file path and internal source role remain preserved; no source bytes are modified.
  • Target selection, authority, upstream behavior, and cleanup details: refused selections create no output directory.
  • Generated metadata, package, or installation impact: none identified.

Expected effects:

  • 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

  • MCP exercises missing and directory paths, invalid UTF-8 and malformed JSON, asserting the caller field and no output directory; built CLI tests assert the related capture field.

  • The memory-boundary regression confirms existing resource refusal behavior after the shared function signature change.

  • Remaining proof gaps: Windows filesystem and stdio MCP were not separately tested; MCP coverage is in-memory against the production handler.

  • 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 test:focused -- tests/boundary/mcp/environmentBundleMcp.test.ts tests/boundary/cli/environmentBuildCli.test.ts tests/process-global/environmentExportMemory.test.ts — 10 passed on macOS.
  • npm run check:fast — passed.
  • git diff HEAD --check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: error issue paths now identify actual caller fields; clients matching the previous incorrect path should update.
  • Real Hopper/Ghidra, browser, or OS coverage: no provider launched; macOS file admission and built CLI tested.
  • Package or release metadata impact: none identified.
  • Security, privacy, process, or containment review: no new execution, mutation, or network behavior.

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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable defect was found.

Summary

Source-file errors now point to the caller's field instead of the reader's internal role.

  • File errors point to the field that supplied the path.

Source review found no actionable new issue or security regression. The diff whitespace check passed; tests were not run during this review. Supersession could not be checked because GitHub access required authentication. The previous-review merge bases differed, so the full PR diff was reviewed.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into codex/fix-envir..." · Reviewed by Greptile

@morluto
morluto marked this pull request as ready for review October 28, 2026 20:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T21:28:47.837692Z b873147 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.

@morluto
morluto merged commit 5147b6e into main Oct 29, 2026
41 checks passed
@morluto
morluto deleted the codex/fix-environment-source-field branch October 29, 2026 00:12
@greptile-apps greptile-apps Bot mentioned this pull request Oct 29, 2026
3 tasks done
@morluto morluto added area: domain Domain logic, errors, and pure functions bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Environment bundle source-file errors identify a field absent from the MCP schema

1 participant