Skip to content

Persist owner standing with revisioned asks and action guards (#629) - #759

Merged
n0rpan merged 34 commits into
mainfrom
agent/629-standing
Nov 17, 2026
Merged

n0rpan merged 34 commits into
mainfrom
agent/629-standing

Conversation

@n0rpan

@n0rpan n0rpan commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

T3 — protected standing rules, holds, asks and owner decisions (#629). Ready for current required CI and Cloud qualification; facts/standing qualification requires both Cloud reviews.

The standing store uses the existing protected file/lock and prepared facts-append APIs. It preserves revision CAS, authority checks, owner text, applied verification, hold/retirement history and bounded active data. It never writes runner task state or launches workers. Public Debug remains available but redacts private owner/command/session payloads, including independently formatted nested types; serialized owner data is retained.

Current candidate a312ba7 reserves a facts source slot during initialization before a competing producer can consume it. Ordinary producers retain all16 slots until standing explicitly initializes. Public Facts::append refuses reserved standing observations/checkpoints and standing-prefixed ask IDs; generated standing asks use their own namespace. This prevents unsynchronized standing revisions and collisions with other fact producers. Existing capacities, budgets, revisions and recovery assertions remain.

Removes: payload-bearing derived Debug implementations (replaced by redacted Debug), public unsynchronized standing-event injection, and unnamespaced generated standing asks. Paging/recovery fixtures now use the protected prepared-append seam rather than bypassing it. The helper's released/retired-rule test changes and both histories are preserved; no branch reset, size split or new feature.

Validation: test-first dbce064 reproduced the Debug boundary failure in hosted lane44130671967. Candidate93ffb228 passed all selected tests except one existing recovery fixture still using public append (lane44148874347). Candidatea312ba7f adapts only that fixture to the protected API while retaining its recovery/no-duplicate assertions; lane44151822193 passed on both architectures. Synthetic data and isolated HOME only, no local builds/tests, real keys or provider calls. Current green CI and both Cloud reviews remain required; this is not landing clearance. The existing397/407/749/776 landing order retains priority.

Ports the standing-asks input to #307 row digest + attn-watch (port plan). Revisioned asks and their close transitions supply the signal for a later wake consumer. The wake service and operational alarms are separate.

Test-first head 651f732b7e09a65075fe9887b4c18daff90e9347 reproduced the reservation retry finding in hosted lane 44162690225. The directory sync failed after the rename, the reserved flag was visible, and the old retry unexpectedly acknowledged it. Fix head df5997e5373acffa1b1cdd3e3554a412deac1f3b reuses Root::durable under the existing facts lock to sync metadata and its directory before acknowledgment. Hosted lane 44164424166 passed on hosted x86_64 and ARM64. Required checks 44164438776 passed. Current-head Cloud code and security reviews reported no findings.

@n0rpan
n0rpan marked this pull request as ready for review November 16, 2026 14:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T20:03:23.593831Z df5997e Manual request
🔒 Security Review ✅ Completed 2026-11-17T20:07:27.284368Z df5997e Manual request
ℹ️ 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.

@n0rpan

n0rpan commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

No P1–P3 findings. Read the full patch, including the complete standing implementation/tests and changes relative to the independently reviewed facts-storage parent. Checked revision conflicts, owner-only initialization/answers, exact proposal binding, preserved owner-hold protection through supersession, monotone lead budget/gate restrictions, named release against a retained matching merge fact, and callback execution under the current stable guard lock. Policy and facts use a bounded prepared handoff with capacity validation before reservation and durability recovery before effects; active rules/asks are never silently evicted. Tests exercise real callbacks, concurrent child-process locking, unavailable/corrupt policy, pending recovery, negative authority cases and mismatched runtime evidence. The module deliberately leaves runtime adapters/action wiring to their owners; Stored does not claim Applied or merged. The size is substantial but bounded and reuses the existing protected-file/facts machinery. No builds/tests run locally. The orchestrator still needs its own oxa-work/trust-boundary read.

@n0rpan

n0rpan commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

First-pass review by oxa → oxc → chatgpt/gpt-6.1-sol at head ccd4344 (O-241; the orchestrator adjudicates and enqueues).

TIER: T3
VERDICT: CLEAR

🤖 Generated with Claude Code (oxa review lane)

@n0rpan
n0rpan marked this pull request as draft November 16, 2026 15:18
@n0rpan
n0rpan marked this pull request as ready for review November 16, 2026 15:42

@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: 4511f9fd89

ℹ️ 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 oxa/oxa-work/src/events.rs Outdated
Comment on lines +182 to +185
situation::apply(&mut snapshot, &event)?;
prepare(&event)?;
state.pending = Some(event_value(&event)?);
self.root.atomic(STATE, &state.bytes()?)?;

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 Preserve projection capacity for prepared standing mutations

If the process stops after prepare(&event) persists a pending standing ask but before the facts reservation is durable, another facts producer can consume the capacity that was just checked. For example, with 127 active situation rows, preparing an ask succeeds; after restart, a runner fact can occupy row 128 before Standing is reopened. Standing::load_facts then retries the pending ask through facts.append, which fails the 128-row limit. Every standing read, answer and guard now fails at that same recovery step—including answering an existing ask to free space. Ensure unrelated facts cannot consume a prepared mutation's reserved projection capacity, or provide a safe recovery path that does not leave all standing operations blocked.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Confirmed. Committed failing-first regression 92e8fe9 reproduces the exact permanent active situation capacity exceeded failure using an actual facts-directory write failure, 127 active rows and a later producer filling the last slot. The fix now reserves an unpublished fact before preparing policy, then makes it replayable only after policy durability. Other appenders cannot steal that capacity; a standing read can cancel a next-revision reservation only when its durable policy has no pending mutation. All 58 work tests pass, including a real child-process crash after preparation, one-time recovery, and a failed owner-release preparation that preserves the hold. Full workspace/strict/native/resource validation is running; PR remains draft.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b084de5 after committed red 92e8fe9. Current-head full workspace passes 3,882 tests/report with zero runtime skips; all 58 work tests, strict all-target clippy, doctests, fmt, scans and links pass. Native held-action/proposal and policy-fsync-EIO recovery pass again. The real crash test proves the reserved last slot remains unavailable to another producer until the prepared fact is recovered once. The failed-policy test proves an unpublished reservation can be discarded without releasing an existing hold. Ordinary facts keep their old append path. Current resource/TTFB measurements and the added policy-mutation sync cost are documented in the body. Own gate43905459154 is green; PR is ready for a fresh full run and review.

@n0rpan

n0rpan commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

No P1–P3 findings. Read the complete resolution delta against ccd4344: standing policy/storage/guard behavior and tests are unchanged. Protocol macro context composes the merged formatting, and the redundant fixture-root modification drops out against the new base. Rechecked that standing checkpoint identity validation remains intact, including reserved source and matching revision. Prior independent checks of authority, revision conflict, durable fact handoff and per-effect locks still apply to identical code. No builds/tests run locally. The orchestrator still needs its own oxa-work/trust-boundary read; no approval is implied.

@n0rpan

n0rpan commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

First-pass review by oxa → oxc → chatgpt/gpt-6.1-sol at head 4511f9f (O-241; the orchestrator adjudicates and enqueues).

Codex findings

CONFIRMED — P2, oxa/oxa-work/src/events.rs:185: prepare(&event) still persists the standing mutation before the facts reservation. A crash in that gap lets another producer consume the remaining projection capacity; recovery then fails in Standing::load_facts, blocking reads, answers and guards, including answers that would free capacity.

TIER: T3
VERDICT: REVISE

🤖 Generated with Claude Code (oxa review lane)

@n0rpan
n0rpan marked this pull request as draft November 16, 2026 15: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: 0e9cdca17e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread oxa/oxa-work/src/standing/store.rs Outdated
const MAX_ACTIVE: usize = 128;
const HISTORY: usize = 16;

#[derive(Clone, Debug, Deserialize, Serialize)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Redact private standing data from Debug output

When a caller formats Read with {:?} for an error or diagnostic, the derived implementation recursively emits every entry and ask, including owner said text, answers, Source::Command.command, and session references. These values are explicitly protected standing data and may contain credentials or private owner instructions, so replace the derived implementation with a redacted Debug (and likewise avoid exposing the independently public nested types).

AGENTS.md reference: AGENTS.md:L10-L13

Useful? React with 👍 / 👎.

Comment on lines 150 to +152
pub fn append(&self, checkpoint: Checkpoint, at_ms: u64, fact: Fact) -> Result<Event> {
self.append_with(checkpoint, at_ms, fact, None::<fn(&Event) -> Result<()>>)
}

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 Reserve StandingChanged for the prepared append path

When any ordinary producer passes the new public Fact::StandingChanged variant to Facts::append, this path commits the reserved standing source without preparing or updating standing.json. Starting from revision 0, such an append at revision 1 makes every subsequent standing read or guard fail with standing file disagrees with facts revision, with no public recovery path. Reject this variant in append so only the crate-private prepared handoff can publish standing revisions.

Useful? React with 👍 / 👎.

Comment thread oxa/oxa-work/src/standing/store.rs Outdated
let before = self.load()?;
let mut after = before.next(expected, at)?;
let ask = Ask {
id: format!("A-{}", after.revision),

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 Namespace standing ask IDs across fact producers

When the shared situation already contains a valid AskOpened from another source with an ID such as A-1, the first standing ask generated at revision 1 reuses that globally keyed ID. situation::open_ask then rejects the standing mutation if the contents differ; if they happen to match, the later standing close removes the unrelated ask because AskClosed also carries only the ID. Include a standing-specific namespace in generated ask IDs so independently valid fact producers cannot collide.

Useful? React with 👍 / 👎.

Comment on lines +273 to +275
if facts.situation()?.standing_revision != 0 {
return Err("standing facts already exist".into());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reserve a facts source slot during standing initialization

When the facts store already contains all 16 allowed non-standing sources, this initialization still succeeds because it checks only standing_revision. The first rule, hold, or ask then reaches append_prepared, fails facts source capacity exceeded, and can never succeed because source metadata has no removal path; the same permanent failure occurs if another producer fills the final slot after initialization but before the first standing mutation. Initialization must reserve the standing source capacity, or ordinary producers must be limited to leave that slot available.

Useful? React with 👍 / 👎.

oxstack-agent added 2 commits November 17, 2026 17:32
`verify` selected an entry by `state != Superseded` alone. A release is a new
entry that supersedes the constraint it releases, so every earlier record
carries `state = Superseded`; the call therefore never matched somebody
else's rule. But `is_live()` also excludes `Retired` and an inactive
constraint in `Stored` state:

- `rule(false, supersedes=Some(id))` stores the release in `Stored` state, and
  a second `rule(_, Owner, Value::Retired, supersedes=Some(id))` stores a
  retired note the same way;
- both were verify-able, so a frontend checker that reports the already
  released value and scope would move the record to `Applied` and advance the
  standing revision;
- the record is not live, `rule()` can never supersede it again (stale
  supersession refuses), and `is_held`/`with_guard` ignore it, so "applied"
  evidence would describe a rule that already released itself.

With_guard, remind and answer already filter on liveness. `verify` now uses
the same `is_live()` predicate. The test fails before the change.

Test: `verify_refuses_released_and_retired_rules` in
`oxa/oxa-work/src/standing/store/tests.rs`.
The new verification test asserted that every non-live entry is `Stored`. A
release or retirement supersedes the record it releases, so that record is
`Superseded` by design; the test failed on the superseded hold rather than on
the behaviour it covers. Assert the two refused records (the release and the
retirement) directly, and that the refused verification changed no state.

Test: `verify_refuses_released_and_retired_rules` in
`oxa/oxa-work/src/standing/store/tests.rs`.
@oxa-agent

oxa-agent Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Five synthetic regressions are pushed at dbce064 before the four new Cloud boundary fixes: protected/nested Debug, ordinary StandingChanged publication, cross-producer ask collision, source-slot reservation race and already-full initialization. Helper727c2820/f7972917 is retained. Returning to draft while these confirmed findings and expected-red controls are repaired; the old conflict-only approval does not certify this new semantic delta. Source writer is codex-lead; no reset/force/rewrite, local test/build, or timer change.

@oxa-agent
oxa-agent Bot marked this pull request as ready for review November 17, 2026 19:32
@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security 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: a312ba7fdc

ℹ️ 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 oxa/oxa-work/src/events.rs Outdated
Comment on lines +174 to +178
if !state.standing_reserved {
state.standing_reserved = true;
self.root.atomic(STATE, &state.bytes()?)?;
}
Ok(())

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 Establish durability when reusing a standing reservation

If the first reservation renames facts.json successfully but its directory sync fails, initialization returns an error while standing_reserved remains visibly true. Retrying initialization then skips this block and can succeed without ever establishing the reservation's durability. With 15 existing sources, a subsequent crash can lose that unsynced rename, allowing another facts producer to consume slot 16 before Standing reopens and permanently preventing standing mutations. The new flag fast path therefore needs to sync the existing metadata before acknowledging the reservation, just as the prepared-event retry path calls durable(STATE).

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: a312ba7fdc

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: df5997e537

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: df5997e537

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@n0rpan
n0rpan added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit c24c3c5 Nov 17, 2026
33 checks passed
@n0rpan
n0rpan deleted the agent/629-standing branch November 17, 2026 20:31
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.

1 participant