Skip to content

fix(acp): preserve content audience boundaries - #10493

Merged
jbg merged 19 commits into
mainfrom
jbg/security-acp-audience-boundaries
Jul 17, 2026
Merged

fix(acp): preserve content audience boundaries#10493
jbg merged 19 commits into
mainfrom
jbg/security-acp-audience-boundaries

Conversation

@jbg

@jbg jbg commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • preserve ACP audience annotations when converting live text, tool-result text, and tool-result images into Goose messages
  • exclude user-only content from provider prompts, compacted handoff context, recipe generation, and planner classification
  • exclude assistant-only content from live events, completed tool-result updates, restored CLI and Desktop sessions, readable Markdown exports, and CLI JSON/input history
  • preserve user-audience tool output in Markdown exports without exposing assistant-only content or disabling argument truncation
  • keep one lossless canonical persisted message while projecting content at agent and user boundaries
  • preserve audience boundaries when streamed text is coalesced, including toolshim and collected-stream paths
  • persist audience-hidden turns without triggering hooks, commands, compaction, empty-response retries, or consuming ACP handoff state
  • normalize the provider-bound projection so removed rows cannot expose invalid role adjacency or empty tool results
  • preserve only agent-visible annotated text across automatic compaction while keeping the archived original user-visible
  • normalize planner history after audience projection so hidden rows cannot leave provider-invalid role adjacency
  • project chatrecall load/search history before endpoint selection, matching, limiting, and rendering
  • project background tool-pair summaries before sending them to the summarization provider
  • project orchestrator first/last session views before selecting endpoints or calculating omitted counts
  • add regression coverage for live updates, tool results, prompt/handoff projection, restore projection, planner classification, and empty filtered prompts

Verification

  • cargo test -p goose-provider-types (423 passed)
  • cargo test -p goose --test agent test_assistant_only_response_is_persisted_without_empty_turn_retry
  • cargo test -p goose --test agent live_tool_result_projects_user_content_but_persists_canonical_result
  • cargo test -p goose --test acp_server_test test_load_session_replays_image_attachment
  • cargo test -p goose-cli --lib (258 passed)
  • cargo test -p goose-cli planner_classification_excludes_user_only_content
  • cargo test --workspace --lib provider_input_ (3 passed)
  • cargo test --workspace --lib markdown_export_preserves_user_audience_tool_output
  • cargo test --workspace --lib first_last_projection_drops_hidden_endpoints_and_content
  • cargo test -p goose preserved_user_message_keeps_audience_projection_after_compaction
  • cargo test -p goose --test compaction (3 passed)
  • cargo test -p goose-cli planner_history_is_fixed_after_audience_projection
  • cargo test -p goose loaded_excerpt_projects_audience_before_selecting_endpoints
  • cargo test -p goose search_projects_audience_before_matching_and_limiting
  • cargo test -p goose tool_pair_summary_ (2 passed)
  • focused hidden-tool-wrapper and skipped-user-message/SessionStart regressions
  • cargo build
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --workspace --all-targets -- -D warnings after the latest review updates and rebase onto current main
  • cargo clippy -p goose --tests -- -D warnings after aligning the compaction visibility regression

This finding was discovered by Project Loupe.

@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: ab74357c7a

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

Comment thread crates/goose/src/acp/provider.rs

@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: 72ee05d1e0

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

Comment thread crates/goose/src/acp/provider.rs

@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: 6bb17bda13

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

Comment thread crates/goose/src/acp/provider.rs

@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: f16d7444df

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

Comment thread crates/goose/src/agents/reply_parts.rs
@jbg

jbg commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the latest empty-turn finding in d9ff7a866:

  • agent bookkeeping now distinguishes substantive provider content from its user-visible projection
  • assistant-only responses remain in provider/session state but no empty user event is emitted
  • genuinely empty responses, including a wrapped empty text block, still take the bounded retry path
  • added regressions for both the assistant-only state case and wrapped-empty recovery

Verified with the focused audience/user-only tests, both new integration regressions, cargo build -p goose, and cargo clippy -p goose --all-targets -- -D warnings.

@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: d9ff7a866c

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

Comment thread crates/goose/src/agents/agent.rs

@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: 538bf204cd

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

Comment thread crates/goose/src/agents/agent.rs

@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: 568e6b7f08

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

Comment thread crates/goose/src/agents/reply_parts.rs
Comment thread crates/goose/src/agents/agent.rs

@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: 3a866ed200

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

Comment thread crates/goose/src/acp/provider.rs

@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: 2fd643dcca

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

Comment thread crates/goose/src/agents/reply_parts.rs Outdated

@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: 4de64b114c

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

Comment thread crates/goose-cli/src/commands/session.rs
Comment thread crates/goose/src/agents/platform_extensions/orchestrator.rs

@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: f0bf5c8ac1

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

Comment thread crates/goose/src/context_mgmt/mod.rs
Comment thread crates/goose-cli/src/session/mod.rs Outdated
@jbg
jbg force-pushed the jbg/security-acp-audience-boundaries branch from f0bf5c8 to 77e9909 Compare July 16, 2026 14:53

@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: 77e990908f

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

Comment thread crates/goose/src/agents/platform_extensions/orchestrator.rs
Comment thread crates/goose/src/context_mgmt/mod.rs
@jbg
jbg requested a review from DOsinga July 16, 2026 15:20
@jbg
jbg requested review from alexhancock and jamadeo July 16, 2026 15:20
@jbg

jbg commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: a1742fdcd3

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

Comment thread crates/goose/src/agents/agent.rs

@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: bb04137ea5

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

Comment thread crates/goose/src/agents/agent.rs
Comment thread crates/goose-provider-types/src/conversation/message.rs Outdated

@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: f4e08b20d1

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

Comment thread crates/goose-cli/src/commands/session.rs
@jbg

jbg commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: f4e08b20d1

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

@jbg
jbg requested review from DOsinga, jamadeo and michaelneale July 16, 2026 17:56

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

nice one, a lot of work.

@jbg
jbg added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit 8168cb8 Jul 17, 2026
26 checks passed
@jbg
jbg deleted the jbg/security-acp-audience-boundaries branch July 17, 2026 09:13
DOsinga pushed a commit that referenced this pull request Jul 29, 2026
The merges with origin/main kept our side of agent.rs and reply_parts.rs
and hand-ported upstream back, which lost work in both directions: #10716's
stable message identity never arrived, and our own MessageContent::Error
rendering was overwritten by a later merge. Nine tests were failing.

Both files now start from origin/main with only the state-machine
integration reapplied, so what was dropped is restored wholesale rather
than one symptom at a time:

- ensure_message_event_id, attach_turn_usage's preferred_message_id, and
  the response-id carrier for split tool-request messages are back, along
  with the upstream tests that cover them. The state-machine dispatch sits
  in reply_impl rather than reply, so it inherits the identity boundary
  too.
- update_session_metrics takes post_compaction_context_tokens again; the
  bool version derived the new baseline from the summary's output tokens
  and ignored everything retained.
- The CLI render paths filter on user visibility again (#10493), keeping
  the MessageContent::Error arms we added on top.
- Stop hooks pass working_dir again. It was the last caller, so the field
  was serialising as null for every hook event.
- command_starts_turn is a shared helper again instead of being inlined at
  its one call site.
- MessageContent::Error handling re-landed in acp/server.rs (including the
  CreditsExhausted route to the payment prompt) and in the markdown export.

Three problems surfaced that were not merge damage:

- goose-cli did not compile: ActionRequiredData gained a
  ToolConfirmationResponse variant that export.rs was never given, and the
  crate is not covered by `cargo test -p goose`.
- Schedule recipe parse errors quoted the file back at the caller, which
  schedule_tool_security guards against. Parse failures get the generic
  message; the semantic checks still report their own wording.
- The platform-extension prompt snapshot had been regenerated without
  code-mode, so it dropped the code_execution section and only matched
  under `cargo test -p goose`.

The scheduler extension contributed a bare `## scheduler` heading to every
prompt: it never set instructions, and it registered even on hosts with no
scheduler service, where it also advertises no tools. client_factory can
now decline, so a platform extension the host cannot provide is not
registered at all.

Also clears `cargo clippy --workspace --all-targets -- -D warnings`: the
dummy API's event builders take a ResponseMeta instead of nine positional
arguments, split_reply builds chunks instead of slicing, and
StateEffect::SetRecipe is boxed.

MERGE_FIXES.md records what was intentional and what is still open; delete
it before the branch merges.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants