Skip to content

refactor(supervisor): pass agent proposal state explicitly#2421

Open
elezar wants to merge 2 commits into
mainfrom
refactor-agent-proposals-state
Open

refactor(supervisor): pass agent proposal state explicitly#2421
elezar wants to merge 2 commits into
mainfrom
refactor-agent-proposals-state

Conversation

@elezar

@elezar elezar commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Replace the process-global agent policy proposal flag with explicit shared AgentProposals state threaded through sandbox, process, and network supervisor runtime paths. This removes downstream dev-dependencies on openshell-core/test-helpers and keeps tests from relying on Cargo feature unification.

Related Issue

N/A

Changes

  • Add explicit AgentProposals shared state in openshell-core and remove the test-helpers feature.
  • Seed proposal state from the initial sandbox settings snapshot and update it from the policy poll loop.
  • Pass proposal state into process setup, policy.local, proxy/L7 evaluation, and deny response rendering.
  • Add a test-only default for L7EvalContext so tests remain compact as context fields grow.
  • Update proposal-related tests to use explicit state instead of a global guard.

Testing

  • mise run pre-commit passes (not run)
  • Unit tests added/updated
  • E2E tests added/updated (not applicable)

Additional checks run:

  • nix develop --command cargo fmt --check
  • nix develop --command cargo check -p openshell-supervisor-network -p openshell-sandbox -p openshell-supervisor-process -p openshell-core --tests
  • nix develop --command cargo test -p openshell-supervisor-network policy_local::tests -- --nocapture
  • nix develop --command cargo test -p openshell-supervisor-network deny_response_body -- --nocapture
  • nix develop --command cargo test -p openshell-supervisor-network send_deny_response_writes_structured_json_403 -- --nocapture
  • nix develop --command cargo test -p openshell-supervisor-network middleware_ -- --nocapture
  • nix develop --command cargo test -p openshell-sandbox agent_proposals_setting -- --nocapture

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (not applicable)

@copy-pr-bot

copy-pr-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@elezar elezar added the test:e2e Requires end-to-end coverage label Jul 22, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied, but pull-request/2421 does not exist yet. A maintainer needs to comment /ok to test ef5b7a73a2ee131bd78793777739dfd9ad4c6856 to mirror this PR. Once the mirror exists, re-apply the label or re-run Branch E2E Checks from the Actions tab.

@elezar elezar added the gator:blocked Gator is blocked by process or repository gates label Jul 22, 2026
@elezar

elezar commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

gator-agent

Blocked

Head SHA: ef5b7a73a2ee131bd78793777739dfd9ad4c6856

Gator is blocked because this PR is still marked as a draft, so the code review workflow should not run yet.

Next action: @elezar, mark the PR ready for review when it is ready for gator to run the independent code review and continue CI monitoring.

@elezar
elezar marked this pull request as ready for review July 23, 2026 08:48

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored refactor is project-valid for OpenShell because it is concentrated in the sandbox/supervisor policy-proposal state path and removes test coupling on a process-global Cargo feature.
Head SHA: ef5b7a73a2ee131bd78793777739dfd9ad4c6856

Review findings:

  • No blocking findings remain.
  • Independent reviewer note: a targeted shared-clone propagation test for AgentProposals would strengthen coverage, but this is not blocking for gator.

Docs: Not needed because this is an internal code refactor with no direct user-facing UX, CLI, policy syntax, provider setup, or published API behavior change.

E2E: test:e2e is already applied because this touches sandbox/network supervisor policy enforcement paths. The current checks are waiting for the copy-pr mirror, and maintainer authority is available to unblock it.

Next state: gator:watch-pipeline

@elezar elezar added gator:watch-pipeline Gator is monitoring PR CI/CD status and removed gator:blocked Gator is blocked by process or repository gates labels Jul 23, 2026
@elezar

elezar commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/ok to test ef5b7a7

@elezar elezar added gator:in-review Gator is reviewing or awaiting PR review feedback and removed gator:watch-pipeline Gator is monitoring PR CI/CD status labels Jul 23, 2026
SDAChess
SDAChess previously approved these changes Jul 23, 2026

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

Looks good, let's merge once the lint passes.

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored refactor is project-valid for OpenShell because it is concentrated in the sandbox/supervisor policy-proposal state path and removes test coupling on a process-global Cargo feature.
Head SHA: 1a57470709fc744b7b8e409fec1697a0cf3fff8e

I rechecked the latest head after @elezar pushed the clippy cleanup and after @SDAChess noted the prior SHA looked good pending lint. The current combined-supervisor path still looks sound, but the sidecar topology has one remaining proposal-state propagation issue.

Review findings:

  • One warning is inline below for sidecar proposal-state propagation.
  • Non-blocking suggestion: add a lifecycle test proving cloned AgentProposals state is shared across PolicyLocalContext, L7 deny response context, and the policy poll/process install path.

Docs: Not needed because this is an internal code refactor with no direct user-facing UX, CLI, policy syntax, provider setup, or published API behavior change.

E2E: test:e2e is already applied for sandbox/network supervisor policy enforcement paths; current checks are still pending.

Next state: gator:in-review

Comment thread crates/openshell-sandbox/src/lib.rs Outdated
retained_proto,
MiddlewareRegistryStatus::Synchronized,
loaded_policy_origin,
false,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

Warning: In sidecar topology this seeds the process supervisor proposal state to false, but the agent container intentionally lacks gateway credentials/env vars, so install_initial_agent_skill() cannot reliably re-fetch the setting. Meanwhile the network sidecar can enable next_steps from its own settings poll, leaving the agent told to read /etc/openshell/skills/policy_advisor.md when the process container may never install it. Please thread agent_proposals_enabled through sidecar_control::BootstrapData, include an update message for later toggles, and have the process-side watcher set the shared flag and install skills on false -> true.

elezar added 2 commits July 23, 2026 17:13
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar
elezar force-pushed the refactor-agent-proposals-state branch from 1a57470 to 359a5bb Compare July 23, 2026 15:40

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored refactor is project-valid for OpenShell because it is concentrated in the sandbox/supervisor policy-proposal state path and removes test coupling on a process-global Cargo feature.
Head SHA: 359a5bb51693c6c24837132afbf651b1258c8af9

I rechecked the latest head after @elezar pushed the sidecar proposal-state update. I also accounted for @SDAChess's maintainer note on the earlier SHA that the change looked good pending lint, and this new head has now had an independent code review.

Review findings:

  • No blocking findings remain.
  • The prior sidecar proposal-state propagation finding appears resolved: bootstrap carries agent_proposals_enabled, sidecar updates include AgentProposalsUpdated, and the process-side watcher applies the shared flag and installs skills on false -> true.
  • Non-blocking suggestion: a targeted regression test proving the same AgentProposals state gates both policy.local and L7 deny-body next_steps would strengthen coverage.

Docs: Not needed because this is an internal state-threading refactor with no direct user-facing UX, CLI, policy syntax, provider setup, or published API behavior change.

E2E: test:e2e is already applied for sandbox/network supervisor policy enforcement paths.

Next state: gator:watch-pipeline

@elezar elezar added gator:watch-pipeline Gator is monitoring PR CI/CD status and removed gator:in-review Gator is reviewing or awaiting PR review feedback labels Jul 23, 2026
@elezar

elezar commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test 359a5bb

@elezar elezar added test:e2e Requires end-to-end coverage and removed test:e2e Requires end-to-end coverage labels Jul 23, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for 359a5bb. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@elezar elezar removed the gator:watch-pipeline Gator is monitoring PR CI/CD status label Jul 23, 2026
@elezar elezar added the gator:approval-needed Gator completed review; maintainer approval needed label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:approval-needed Gator completed review; maintainer approval needed test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants