Skip to content

feat(agent): bind sessions safely - #94

Open
ben-ranford wants to merge 11 commits into
feat/46-config-ownershipfrom
feat/62-session-agent-bridge
Open

ben-ranford wants to merge 11 commits into
feat/46-config-ownershipfrom
feat/62-session-agent-bridge

Conversation

@ben-ranford

Copy link
Copy Markdown
Owner

Summary

  • problem: Session integrators currently hand-assemble agent snapshot metadata and cancellation callbacks.
  • change: Add an opt-in session bridge for validated full/patch snapshots, redacted diagnostics, and idempotent session cancellation. Host authorization and confirmation remain explicit.
  • compatibility: Additive API; existing protocol and application action ownership are preserved. Temporarily stacked on feat(agent): project validated config limits #74 for the config ownership API; retarget to main after that parent merges.

Closes #62

Validation

  • Focused agent/session tests and race checks.
  • Generated dependency and public API inventories refreshed.
  • make ci — exit 0 (/tmp/stave-62-make-ci-final.log), includes repository fast/verify gates.

Release Notes

Scope firewall: A review item belongs here only if it directly prevents #62 acceptance and is an incremental correction in the initially touched production surface. Shared files or wording do not justify adjacent work.

@ben-ranford ben-ranford added this to the v1.1.0 milestone Sep 13, 2026
@ben-ranford ben-ranford added area:agent Semantic snapshots, JSONL/JSON-RPC, automation, and accessibility type:feature Additive user-facing library capability or workflow priority:p1 Foundational or high-impact milestone work labels Sep 13, 2026
@ben-ranford ben-ranford self-assigned this Sep 13, 2026
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 12:18
@ben-ranford
ben-ranford requested a lite review from Copilot September 13, 2026 12:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 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-09-14T14:39:51.993528Z 0efd698 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.

@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: 27077f1478

ℹ️ 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 runtime/agent/session_bridge.go Outdated
Comment thread runtime/agent/session_bridge.go Outdated
Comment thread runtime/agent/session_bridge.go

Copilot AI 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.

🟡 Changes recommended

Resolve the two moderate session-bridge correctness issues before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds an opt-in session-to-agent bridge for snapshots, diagnostics, and idempotent cancellation while preserving application-owned authorization.

Changes:

  • Adds full/patch snapshot support and cancellation wiring.
  • Adds focused tests and ownership documentation.
  • Refreshes generated API and dependency inventories.
File summaries
File Review notes
scripts/rigor/generated/public-api.txt Generated API inventory updated.
scripts/rigor/generated/dependency-inventory.json Generated dependency inventory updated.
runtime/agent/session_bridge.go Two moderate issues: validate snapshot hash metadata, and make concurrent snapshot baseline handling deterministic.
runtime/agent/session_bridge_test.go Adds snapshot and cancellation coverage.
docs/config-ownership.md Add the required changelog entry for the user-visible bridge change (nit).
Review details

Suppressed comments (2)

docs/config-ownership.md:38

  • This adds an exported, user-visible session bridge, but CHANGELOG.md's Unreleased section remains empty. The repository policy requires updating it for user-visible behavior changes (CONTRIBUTING.md:38), so add the bridge release-note entry before merging.
`agent.BindSession` is an opt-in local-checkout API. It supplies a session's
snapshot envelope and an idempotent cancellation callback, while the
application continues to supply the action registry, authorization,
confirmation, and policy callbacks in `agent.Options`. It does not select a
transport or grant action authority.

runtime/agent/session_bridge.go:44

  • Server.Serve dispatches non-control requests, including snapshots, to up to MaxInFlight workers, so this single previous baseline is not tied to request order. A valid full request followed by a patch can be scheduled with the patch first and be rejected as stale, or another snapshot can replace the baseline before the patch; the bridge therefore behaves nondeterministically under concurrent clients/requests. Serialize snapshot handling in the server or retain per-revision baselines instead of relying on one implicit previous state.
	mu          sync.Mutex
	previous    state.State[M]
	hasPrevious bool
	cancelOnce  sync.Once
  • Files reviewed: 3/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread runtime/agent/session_bridge.go
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 13:40
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 13:40

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

ℹ️ 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 runtime/agent/session_bridge.go Outdated
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 14:24
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 14:24

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

ℹ️ 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 runtime/agent/session_bridge.go Outdated
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 15:06
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 15:06

@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: 08172e552f

ℹ️ 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 runtime/agent/session_bridge.go
@ben-ranford
ben-ranford marked this pull request as draft September 14, 2026 13:07
@ben-ranford
ben-ranford marked this pull request as ready for review September 14, 2026 13:07
@ben-ranford

Copy link
Copy Markdown
Owner Author

Sonar API audit

Reviewed commit: 6c15f393cfc6e5af5681e6eed98cab0b9b5ebaee.

Live public SonarCloud API queries for PR #94 returned:

  • Open issues: 0 (api/issues/search, resolved=false, all severities; total 0).
  • Security hotspots: 0 (api/hotspots/search; total 0).
  • Current-head Sonar check: passed (check run 103986481189).

Audited via CLI at 2026-09-14T13:10:27.202527+00:00. Project visibility was verified as public. No findings were changed or suppressed.

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

ℹ️ 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 runtime/agent/session_bridge.go
@ben-ranford
ben-ranford marked this pull request as draft September 14, 2026 13:32
@ben-ranford
ben-ranford marked this pull request as ready for review September 14, 2026 13:32

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

ℹ️ 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 runtime/agent/session_bridge.go
Comment thread runtime/agent/session_bridge.go
@ben-ranford
ben-ranford marked this pull request as draft September 14, 2026 13:37
@ben-ranford
ben-ranford marked this pull request as ready for review September 14, 2026 13:37

@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: 659870bc08

ℹ️ 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 runtime/agent/session_bridge.go
@ben-ranford

Copy link
Copy Markdown
Owner Author

Sonar API audit

Reviewed commit: 659870bc08fb81c269cffb436e08cdd4182181d2.

Live public SonarCloud API queries for PR #94 returned:

  • Open issues: 0 (api/issues/search, resolved=false, all severities; total 0).
  • Security hotspots: 0 (api/hotspots/search; total 0).
  • Current-head Sonar check: passed (check run 103996678660).

Audited via CLI at 2026-09-14T13:50:12.117394+00:00. Project visibility was verified as public. No findings were changed or suppressed.

@ben-ranford
ben-ranford marked this pull request as draft September 14, 2026 14:20
@ben-ranford
ben-ranford marked this pull request as ready for review September 14, 2026 14:20
@ben-ranford

Copy link
Copy Markdown
Owner Author

Sonar API audit

Reviewed commit: 53a035df02476da864af2b14c60b02be744edf9f.

Live public SonarCloud API queries for PR #94 returned:

  • Open issues: 0 (api/issues/search, resolved=false, all severities; total 0).
  • Security hotspots: 0 (api/hotspots/search; total 0).
  • Current-head Sonar check: passed (check run 104012015249).

Audited via CLI at 2026-09-14T14:21:13.602077+00:00. Project visibility was verified as public. No findings were changed or suppressed.

@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: 53a035df02

ℹ️ 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 runtime/agent/session_bridge.go
@ben-ranford
ben-ranford marked this pull request as draft September 14, 2026 14:34
@ben-ranford
ben-ranford marked this pull request as ready for review September 14, 2026 14:34
@sonarqubecloud

Copy link
Copy Markdown

@ben-ranford

Copy link
Copy Markdown
Owner Author

Sonar API audit

Reviewed commit: 0efd698bfdc18cfa67d28cad247b48e0518a753c.

Live public SonarCloud API queries for PR #94 returned:

  • Open issues: 0 (api/issues/search, resolved=false, all severities; total 0).
  • Security hotspots: 0 (api/hotspots/search; total 0).
  • Current-head Sonar check: passed (check run 104017446252).

Audited via CLI at 2026-09-14T14:35:09.750319+00:00. Project visibility was verified as public. No findings were changed or suppressed.

@ben-ranford
ben-ranford force-pushed the feat/46-config-ownership branch from 6aa707a to fe6602d Compare September 15, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Semantic snapshots, JSONL/JSON-RPC, automation, and accessibility priority:p1 Foundational or high-impact milestone work type:feature Additive user-facing library capability or workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants