Skip to content

Codex/aura enterprise maturity f - #11

Open
youngbryan97 wants to merge 5 commits into
mainfrom
codex/aura-enterprise-maturity-f
Open

Codex/aura enterprise maturity f#11
youngbryan97 wants to merge 5 commits into
mainfrom
codex/aura-enterprise-maturity-f

Conversation

@youngbryan97

Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Pass F maturity: auto action expectations, durable receipts, and effect verification

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Auto-generate expectations for file/memory mutations to prevent shallow “success”.
• Persist expectation verdict receipts and record PASSF shallow-success fault occurrences.
• Register Pass F risks in taxonomy/FMEA with runbook links and regression coverage.
Diagram

graph TD
  Chat["Chat route (desktop objective)"] --> CE["CapabilityEngine"] --> Skills["Skills: file_operation + memory_ops"] --> Evidence["Effect evidence (sha256/effect_verified)"]
  CE --> Receipts[("Receipt store")]
  CE --> Faults["Fault registry (PASSF)"] --> FMEA["FMEA registry/report"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Require explicit action_expectation from all callers
  • ➕ No heuristics/defaults in CapabilityEngine; fewer implicit contracts
  • ➕ Clear per-call intent owned by caller
  • ➖ Easy to forget expectations, reintroducing shallow-success regressions
  • ➖ Hard to enforce consistently across multiple call sites/lanes
2. Schema-driven skill contracts per action (typed receipts/results)
  • ➕ Stronger, versionable contract for evidence fields per action
  • ➕ Better long-term compatibility as skills evolve
  • ➖ Larger upfront refactor (contract definitions, migrations, tooling)
  • ➖ Slower to deploy incremental coverage for high-risk mutations
3. Centralize effect verification in ActionExecutor/governed ops
  • ➕ Keeps verification logic close to actual file/memory write primitives
  • ➕ Reduces duplicate verification code across skills
  • ➖ Some verifications are semantic (e.g., move/copy semantics) and still skill-specific
  • ➖ Harder to express per-skill acceptance criteria and user-visible effect messaging

Recommendation: The PR’s approach is a pragmatic middle ground: CapabilityEngine provides default expectations only for high-confidence, deterministic mutations (file_operation and core memory blocks), while skills return concrete evidence (sha256/effect_verified) and the engine makes the outcome durable via receipts and PASSF fault occurrences. Consider evolving toward schema-driven contracts over time, but the current incremental expansion is appropriate for reducing shallow-success risk quickly without forcing broad caller changes.

Files changed (14) +1413 / -13

Enhancement (4) +582 / -0
capability_engine.pyAuto-generate mutation expectations and emit durable verdict receipts +168/-0

Auto-generate mutation expectations and emit durable verdict receipts

• Adds default ActionExpectation generation for mutating file_operation actions and core memory mutations (core_append/core_replace), with opt-out via disable_auto_action_expectation. Extends expectation result handling to emit a durable ToolExecutionReceipt (including digest + verdict metadata) and records PASSF-ACTION-SHALLOW-SUCCESS when a verdict fails.

core/capability_engine.py

fault_taxonomy.pyRegister PASSF failure modes in built-in fault taxonomy +158/-0

Register PASSF failure modes in built-in fault taxonomy

• Introduces ten PASSF-* fault definitions with severity/probability/detection/recovery metadata. Links the new faults to a shared Pass F maturity runbook for operational handling and traceability.

core/resilience/fault_taxonomy.py

fmea_registry.pyAdd PASSF and action-claim mismatch entries to the FMEA registry +243/-0

Add PASSF and action-claim mismatch entries to the FMEA registry

• Extends FMEA reporting with mitigation_count for easier diagnostics consumption. Registers built-in FMEA entries for PASSF-* faults and ACTION-CLAIM-MISMATCH, each with mitigation actions pointing to concrete implementation/runbook artifacts.

core/resilience/fmea_registry.py

chat.pyPropagate desktop_task action expectations through chat execution lane +13/-0

Propagate desktop_task action expectations through chat execution lane

• Adds a desktop-task expectation generator and passes the expectation through both params and context when executing desktop objectives. Ensures CapabilityEngine sees and enforces action-depth contracts before reporting chat success.

interface/routes/chat.py

Bug fix (2) +176 / -13
file_operation.pyVerify file mutation effects with sha256-backed evidence +101/-6

Verify file mutation effects with sha256-backed evidence

• Adds helpers to compute content/file hashes and to verify post-action filesystem state asynchronously. Mutating actions (write/append/patch/delete/move/copy) now return effect_verified plus evidence fields and criteria_results so expectations can be validated reliably.

core/skills/file_operation.py

memory_ops.pyVerify core memory writes and return deterministic evidence +75/-7

Verify core memory writes and return deterministic evidence

• Adds sha256 hashing and persisted-block verification for core_append and core_replace. Memory mutations now check ActionExecutor results, then return effect_verified/sha256/expected_sha256/bytes and criteria_results to prevent unverified memory-write success.

core/skills/memory_ops.py

Tests (5) +281 / -0
test_action_depth_honesty.pyAssert file_operation.write returns effect evidence and criteria results +24/-0

Assert file_operation.write returns effect evidence and criteria results

• Adds a unit test verifying that file_operation.write returns ok, sha256, expected_sha256, effect_verified, and criteria_results, and that the file content matches.

tests/test_action_depth_honesty.py

test_capability_engine_policy_regressions.pyAdd regressions for receipt emission and auto expectations (file/memory) +192/-0

Add regressions for receipt emission and auto expectations (file/memory)

• Adds tests proving expectation downgrade emits a durable receipt and records PASSF-ACTION-SHALLOW-SUCCESS using stubbed registries and an isolated receipt store. Adds regressions for auto file_operation expectation enforcement, exclusion of read-only actions, and auto memory_ops core_append enforcement.

tests/test_capability_engine_policy_regressions.py

test_memory_facade_runtime.pyAssert memory_ops core append returns sha256-backed verification evidence +5/-0

Assert memory_ops core append returns sha256-backed verification evidence

• Extends the runtime test to assert effect_verified, block identity, sha256, and criteria_results for core memory append.

tests/test_memory_facade_runtime.py

test_reliability_hardening.pyEnforce PASSF taxonomy/FMEA/runbook registration via tests +47/-0

Enforce PASSF taxonomy/FMEA/runbook registration via tests

• Adds tests asserting PASSF fault definitions are registered and linked to runbooks, and that high-risk PASSF faults remain visible in RPN reporting. Adds FMEA assertions that PASSF faults are mitigated, have expected runbook path, and have mitigation depth.

tests/test_reliability_hardening.py

test_server_conversation_lane.pyVerify chat desktop objective passes action_expectation through params/context +13/-0

Verify chat desktop objective passes action_expectation through params/context

• Updates conversation-lane tests to assert the generated desktop_task action_expectation is included in the governed skill params and forwarded in extra context. Confirms expectation fields like required_evidence and repair_hint are preserved end-to-end.

tests/test_server_conversation_lane.py

Documentation (3) +374 / -0
AURA_EXECUTION_TRACKER.mdDocument Pass F checkpoints, verification commands, and remaining work +314/-0

Document Pass F checkpoints, verification commands, and remaining work

• Appends detailed checkpoint notes describing expectation propagation, PASSF registry work, durable receipt emission, and verified file/memory mutations. Captures verification commands and gates used to validate the changes.

docs/AURA_EXECUTION_TRACKER.md

README.mdLink Pass F maturity runbook from runbook index +1/-0

Link Pass F maturity runbook from runbook index

• Adds the new pass-f-maturity-risks.md to the runbooks table for discoverability.

docs/runbooks/README.md

pass-f-maturity-risks.mdAdd operational runbook for Pass F maturity risks +59/-0

Add operational runbook for Pass F maturity risks

• Introduces a runbook outlining symptoms, diagnosis, safe/unsafe mitigations, rollback, and verification steps. Designed to back the PASSF fault taxonomy and FMEA entries with an actionable operator playbook.

docs/runbooks/pass-f-maturity-risks.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (1) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 9 rules

Grey Divider


Action required

1. _action_expectation_digest() swallows exceptions 📘 Rule violation ☼ Reliability
Description
_action_expectation_digest() catches TypeError/ValueError and falls back to str(payload)
without recording a degradation event. This can hide serialization failures and reduce observability
of malformed receipt/verdict payloads.
Code

core/capability_engine.py[R4508-4517]

+    def _action_expectation_digest(payload: dict[str, Any]) -> str:
+        try:
+            encoded = json.dumps(
+                payload,
+                sort_keys=True,
+                separators=(",", ":"),
+                default=str,
+            ).encode("utf-8")
+        except (TypeError, ValueError):
+            encoded = str(payload).encode("utf-8", errors="replace")
Evidence
The checklist requires exception handlers to re-raise or record degradations via
record_degradation(...). The new handler in _action_expectation_digest() catches exceptions and
proceeds without any degradation recording/logging.

Rule 1534850: Exception handlers must record degradation instead of silently swallowing errors
core/capability_engine.py[4508-4517]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`core/capability_engine.py::_action_expectation_digest()` catches `TypeError`/`ValueError` from `json.dumps(...)` but does not call `record_degradation(...)` (or the local wrapper `_record_capability_degradation(...)`). This silently swallows an error condition and violates the requirement that exception handlers must record degradations.

## Issue Context
There is already a project-standard helper `_record_capability_degradation(...)` in this module that wraps `record_degradation(...)`. Use it in the exception handler and capture the exception via `as exc`.

## Fix Focus Areas
- core/capability_engine.py[4508-4517]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Copy verifies wrong target 🐞 Bug ≡ Correctness
Description
FileOperationSkill.copy and FileOperationSkill.move verify post-action effects using the
requested destination path (full_dest) instead of the final destination returned by the governed
operation (result['destination']). When the destination is a directory, this validates the
directory rather than the copied/moved file, which can skip sha256-based comparison, lose evidence,
and cause expectation checks to be bypassed or downgraded.
Code

core/skills/file_operation.py[R314-328]

+                source_effect = await self._file_effect(full_path)
+                dest_effect = await self._file_effect(full_dest)
+                effect_verified = bool(dest_effect.get("effect_verified"))
+                if source_effect.get("sha256") and dest_effect.get("sha256"):
+                    effect_verified = source_effect["sha256"] == dest_effect["sha256"]
+                return {
+                    "ok": effect_verified,
+                    "summary": f"Copied {path} to {dest_path}",
+                    "path": path,
+                    "destination": dest_path,
+                    "source_sha256": source_effect.get("sha256", ""),
+                    "criteria_results": {"path copied": effect_verified},
+                    **dest_effect,
+                    "effect_verified": effect_verified,
+                }
Evidence
In both governed copy and move flows, the backend returns a resolved final destination path in the
action result (e.g., when the requested destination is a directory, the final path becomes
<dst_dir>/<basename>), but the skill verifies effects against full_dest rather than that
returned destination. Because _file_effect only computes and emits sha256 when the verified
path is a file, verifying a directory destination prevents hashing and therefore bypasses the
file-vs-file hash comparison logic, weakening or breaking the expectations/evidence contract
(including potential expectation downgrades).

core/skills/file_operation.py[297-328]
core/runtime/action_executor.py[133-153]
core/runtime/file_write_gateway.py[234-262]
core/skills/file_operation.py[71-92]
core/skills/file_operation.py[266-295]
core/runtime/file_write_gateway.py[207-232]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`file_operation` copy and move compute post-action evidence against `full_dest` (the requested destination), but the governed backend returns a *final* destination path in `result["destination"]` that can differ when the destination is a directory (e.g., `shutil.copy2(src, dst_dir)` returns `<dst_dir>/<basename>` and `shutil.move(src, dst_dir)` similarly resolves to the moved file path). Verifying `full_dest` can therefore verify the wrong object (a directory instead of the copied/moved file), omit `sha256`, skip hash comparison, and cause action expectation checks to be bypassed or downgraded.

## Issue Context
- `ActionExecutor` returns `{"destination": final}` for `op == "copy"` and `op == "move"`.
- `file_write_gateway.copy_path_async` returns `str(shutil.copy2(...))` or `str(shutil.copytree(...))`.
- `file_write_gateway.move_path_async` returns `str(shutil.move(src, dst))`, which changes when `dst` is a directory.
- `_file_effect` only emits `sha256` when the verified path is a file, so verifying a directory destination loses required hash evidence.

## Fix Focus Areas
- core/skills/file_operation.py[266-328]
- core/runtime/action_executor.py[133-153]
- core/runtime/file_write_gateway.py[207-262]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Dir move/copy needs sha256 🐞 Bug ≡ Correctness
Description
CapabilityEngine auto-generates ActionExpectations for file_operation move/copy that always
require sha256, but file_operation explicitly supports directory paths and _file_effect does
not emit sha256 for directories, so successful directory move/copy operations will be downgraded
to success_unverified (making ok=False).
Code

core/capability_engine.py[R4429-4430]

+            "move": ("path moved", ["path", "destination", "sha256", "effect_verified"]),
+            "copy": ("path copied", ["path", "destination", "sha256", "effect_verified"]),
Evidence
The default expectation contract requires sha256 for move/copy, but the skill supports directories
and _file_effect omits sha256 for non-files; the expectation evaluator turns missing evidence
into SUCCESS_UNVERIFIED, and CapabilityEngine then reports ok=False because only
SUCCESS_VERIFIED is ok.

core/capability_engine.py[4421-4431]
core/skills/file_operation.py[15-22]
core/skills/file_operation.py[71-92]
core/runtime/skill_contract.py[159-188]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Auto-generated expectations for `file_operation` move/copy currently require `sha256`, but directory operations are supported and cannot satisfy that evidence key (since `_file_effect` only hashes files). This causes directory move/copy to be treated as missing evidence and downgraded to `success_unverified`.

### Issue Context
- `FileOpInput.path` is documented as "Target file or directory path".
- `_file_effect` only adds `sha256` when `is_file` is true.
- Missing evidence (without missing criteria) maps to `SkillStatus.SUCCESS_UNVERIFIED`.

### Fix Focus Areas
- core/capability_engine.py[4421-4431]
- core/skills/file_operation.py[15-22]
- core/skills/file_operation.py[71-92]
- core/runtime/skill_contract.py[159-188]

### Proposed fix options
Option A (lowest risk):
- Remove `sha256` from the default `move`/`copy` expectation required_evidence list (keep it for write/append/patch).

Option B (stronger verification):
- Extend `file_operation` to emit a deterministic directory digest (e.g., `tree_sha256`) for directories, and update the default expectation logic to require the appropriate digest for directories.

Option C (more invasive):
- Extend `ActionExpectation` to support alternative evidence keys (e.g., `sha256 OR tree_sha256`) so directories and files can both satisfy the contract cleanly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Memory hashing blocks loop 🐞 Bug ➹ Performance
Description
MemoryOpsSkill now reads and hashes the core memory file synchronously inside an async execution
path (_core_memory_effect), which can block the event loop as memory blocks grow and increase tail
latency for concurrent requests.
Code

core/skills/memory_ops.py[R101-128]

+    def _file_sha256(path: Path) -> str:
+        digest = hashlib.sha256()
+        with open(path, "rb") as fh:
+            for chunk in iter(lambda: fh.read(1024 * 1024), b""):
+                digest.update(chunk)
+        return digest.hexdigest()
+
+    @classmethod
+    def _core_memory_effect(
+        cls,
+        block_path: Path,
+        *,
+        expected_sha256: str,
+    ) -> dict[str, Any]:
+        exists = block_path.exists()
+        effect: dict[str, Any] = {
+            "path": str(block_path),
+            "exists": exists,
+            "effect_verified": False,
+        }
+        if exists:
+            sha256 = cls._file_sha256(block_path)
+            effect.update({
+                "sha256": sha256,
+                "bytes": block_path.stat().st_size,
+                "expected_sha256": expected_sha256,
+                "effect_verified": sha256 == expected_sha256,
+            })
Evidence
The new core-memory effect computation performs synchronous filesystem reads/hashing and is called
from an async method; in contrast, the file skill explicitly offloads hashing/stat to a background
thread via asyncio.to_thread.

core/skills/memory_ops.py[100-171]
core/skills/file_operation.py[71-88]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`MemoryOpsSkill._core_memory_effect` performs blocking file I/O (`open`, `read`, `stat`) and hashing on the event loop thread, but it is called from async `execute` paths. This can block the loop for large core-memory blocks.

### Issue Context
`FileOperationSkill` uses `asyncio.to_thread(...)` for similar filesystem hashing and stat calls, indicating the intended pattern.

### Fix Focus Areas
- core/skills/memory_ops.py[100-171]
- core/skills/file_operation.py[71-88]

### Proposed fix
- Make `_core_memory_effect` async and move the hashing/stat work into `asyncio.to_thread`.
 - e.g., `effect = await asyncio.to_thread(self._core_memory_effect_sync, block_path, expected_sha256)`
- Consider also moving the initial `open(block_path).read()` in `_execute_core_memory` to `asyncio.to_thread` for consistency.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread core/capability_engine.py
Comment on lines +4508 to +4517
def _action_expectation_digest(payload: dict[str, Any]) -> str:
try:
encoded = json.dumps(
payload,
sort_keys=True,
separators=(",", ":"),
default=str,
).encode("utf-8")
except (TypeError, ValueError):
encoded = str(payload).encode("utf-8", errors="replace")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. _action_expectation_digest() swallows exceptions 📘 Rule violation ☼ Reliability

_action_expectation_digest() catches TypeError/ValueError and falls back to str(payload)
without recording a degradation event. This can hide serialization failures and reduce observability
of malformed receipt/verdict payloads.
Agent Prompt
## Issue description
`core/capability_engine.py::_action_expectation_digest()` catches `TypeError`/`ValueError` from `json.dumps(...)` but does not call `record_degradation(...)` (or the local wrapper `_record_capability_degradation(...)`). This silently swallows an error condition and violates the requirement that exception handlers must record degradations.

## Issue Context
There is already a project-standard helper `_record_capability_degradation(...)` in this module that wraps `record_degradation(...)`. Use it in the exception handler and capture the exception via `as exc`.

## Fix Focus Areas
- core/capability_engine.py[4508-4517]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +314 to +328
source_effect = await self._file_effect(full_path)
dest_effect = await self._file_effect(full_dest)
effect_verified = bool(dest_effect.get("effect_verified"))
if source_effect.get("sha256") and dest_effect.get("sha256"):
effect_verified = source_effect["sha256"] == dest_effect["sha256"]
return {
"ok": effect_verified,
"summary": f"Copied {path} to {dest_path}",
"path": path,
"destination": dest_path,
"source_sha256": source_effect.get("sha256", ""),
"criteria_results": {"path copied": effect_verified},
**dest_effect,
"effect_verified": effect_verified,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Copy verifies wrong target 🐞 Bug ≡ Correctness

FileOperationSkill.copy and FileOperationSkill.move verify post-action effects using the
requested destination path (full_dest) instead of the final destination returned by the governed
operation (result['destination']). When the destination is a directory, this validates the
directory rather than the copied/moved file, which can skip sha256-based comparison, lose evidence,
and cause expectation checks to be bypassed or downgraded.
Agent Prompt
## Issue description
`file_operation` copy and move compute post-action evidence against `full_dest` (the requested destination), but the governed backend returns a *final* destination path in `result["destination"]` that can differ when the destination is a directory (e.g., `shutil.copy2(src, dst_dir)` returns `<dst_dir>/<basename>` and `shutil.move(src, dst_dir)` similarly resolves to the moved file path). Verifying `full_dest` can therefore verify the wrong object (a directory instead of the copied/moved file), omit `sha256`, skip hash comparison, and cause action expectation checks to be bypassed or downgraded.

## Issue Context
- `ActionExecutor` returns `{"destination": final}` for `op == "copy"` and `op == "move"`.
- `file_write_gateway.copy_path_async` returns `str(shutil.copy2(...))` or `str(shutil.copytree(...))`.
- `file_write_gateway.move_path_async` returns `str(shutil.move(src, dst))`, which changes when `dst` is a directory.
- `_file_effect` only emits `sha256` when the verified path is a file, so verifying a directory destination loses required hash evidence.

## Fix Focus Areas
- core/skills/file_operation.py[266-328]
- core/runtime/action_executor.py[133-153]
- core/runtime/file_write_gateway.py[207-262]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread core/capability_engine.py
Comment on lines +4429 to +4430
"move": ("path moved", ["path", "destination", "sha256", "effect_verified"]),
"copy": ("path copied", ["path", "destination", "sha256", "effect_verified"]),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Dir move/copy needs sha256 🐞 Bug ≡ Correctness

CapabilityEngine auto-generates ActionExpectations for file_operation move/copy that always
require sha256, but file_operation explicitly supports directory paths and _file_effect does
not emit sha256 for directories, so successful directory move/copy operations will be downgraded
to success_unverified (making ok=False).
Agent Prompt
### Issue description
Auto-generated expectations for `file_operation` move/copy currently require `sha256`, but directory operations are supported and cannot satisfy that evidence key (since `_file_effect` only hashes files). This causes directory move/copy to be treated as missing evidence and downgraded to `success_unverified`.

### Issue Context
- `FileOpInput.path` is documented as "Target file or directory path".
- `_file_effect` only adds `sha256` when `is_file` is true.
- Missing evidence (without missing criteria) maps to `SkillStatus.SUCCESS_UNVERIFIED`.

### Fix Focus Areas
- core/capability_engine.py[4421-4431]
- core/skills/file_operation.py[15-22]
- core/skills/file_operation.py[71-92]
- core/runtime/skill_contract.py[159-188]

### Proposed fix options
Option A (lowest risk):
- Remove `sha256` from the default `move`/`copy` expectation required_evidence list (keep it for write/append/patch).

Option B (stronger verification):
- Extend `file_operation` to emit a deterministic directory digest (e.g., `tree_sha256`) for directories, and update the default expectation logic to require the appropriate digest for directories.

Option C (more invasive):
- Extend `ActionExpectation` to support alternative evidence keys (e.g., `sha256 OR tree_sha256`) so directories and files can both satisfy the contract cleanly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread core/skills/memory_ops.py
Comment on lines +101 to +128
def _file_sha256(path: Path) -> str:
digest = hashlib.sha256()
with open(path, "rb") as fh:
for chunk in iter(lambda: fh.read(1024 * 1024), b""):
digest.update(chunk)
return digest.hexdigest()

@classmethod
def _core_memory_effect(
cls,
block_path: Path,
*,
expected_sha256: str,
) -> dict[str, Any]:
exists = block_path.exists()
effect: dict[str, Any] = {
"path": str(block_path),
"exists": exists,
"effect_verified": False,
}
if exists:
sha256 = cls._file_sha256(block_path)
effect.update({
"sha256": sha256,
"bytes": block_path.stat().st_size,
"expected_sha256": expected_sha256,
"effect_verified": sha256 == expected_sha256,
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Memory hashing blocks loop 🐞 Bug ➹ Performance

MemoryOpsSkill now reads and hashes the core memory file synchronously inside an async execution
path (_core_memory_effect), which can block the event loop as memory blocks grow and increase tail
latency for concurrent requests.
Agent Prompt
### Issue description
`MemoryOpsSkill._core_memory_effect` performs blocking file I/O (`open`, `read`, `stat`) and hashing on the event loop thread, but it is called from async `execute` paths. This can block the loop for large core-memory blocks.

### Issue Context
`FileOperationSkill` uses `asyncio.to_thread(...)` for similar filesystem hashing and stat calls, indicating the intended pattern.

### Fix Focus Areas
- core/skills/memory_ops.py[100-171]
- core/skills/file_operation.py[71-88]

### Proposed fix
- Make `_core_memory_effect` async and move the hashing/stat work into `asyncio.to_thread`.
  - e.g., `effect = await asyncio.to_thread(self._core_memory_effect_sync, block_path, expected_sha256)`
- Consider also moving the initial `open(block_path).read()` in `_execute_core_memory` to `asyncio.to_thread` for consistency.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

TheITVeteran pushed a commit to TheITVeteran/aura that referenced this pull request Jul 17, 2026
The critique's item youngbryan97#11: "a godlike system that believes itself too easily is not godlike. It is
brittle." Aura had plan critique (critic_engine) and a project-level claim matrix, but no runtime
epistemic critic interrogating a specific claim before it's trusted/emitted.
core/cognition/adversarial_audit.py runs the doc's checklist as concrete, grounded checks:

  overclaiming        absolute/grandiose language
  action_done         claim asserts an action but nothing confirms it ran
  receipt_exists      asserted action with no verifiable receipt (checked against the Will audit
                      trail / Outcome Ledger — real grounding, not string matching)
  stale_memory        leans on a memory past its freshness horizon
  world_state_current leans on a stale world-state snapshot
  evidence            factual assertion with no evidence cited
  persona_leak        first-person phenomenal claims stated as literal fact
  user_projection     asserts the user's state when the live other-agent estimate is low-confidence
  falsifiability      a strong claim with no stated way it could be wrong

Returns an AuditReport: per-check findings, a severity-weighted risk score, a verdict
(trust/caveat/block), and concrete suggested caveats — turning "honest assessments over
validation" into a mechanism. Cross-wired to the receipt substrate and the other-agent estimate so
the checks reflect real runtime state. Registered as 'adversarial_auditor' (lazy, required=False).

Also strengthened OtherAgentStateEstimator.overall_confidence: average over channels that actually
have evidence rather than all channels (averaging in never-observed channels structurally capped a
strong, focused read too low) — a more honest confidence used by the audit's projection grounding,
the value model's protect-future-self check, and the ladder's social signals. 21 social tests still
green.

tests/test_adversarial_audit.py: 16 tests (every check, receipt verified via Will, projection
grounded/ungrounded against the estimate, severity-weighted risk, block aggregation). 95 green
across the full new social/world-model/memory/values/cognition/agency cluster.

Co-Authored-By: Claude Opus 4.8 <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.

1 participant