Skip to content

WS-XINT-002-03: activate internal artifact services - #212

Merged
abiorh-claw merged 8 commits into
mainfrom
codex/ws-xint-002-03-internal-service-activation
Jul 28, 2026
Merged

WS-XINT-002-03: activate internal artifact services#212
abiorh-claw merged 8 commits into
mainfrom
codex/ws-xint-002-03-internal-service-activation

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

WS-XINT-002-03 PR Trust Bundle

Chunk

WS-XINT-002-03 — Internal Service Activation (L1).

Goal and intent

Activate the minimum fixed ART service authority needed for verification,
pending-work scanning, and put-attempt resolution while preserving PREP's
transaction binding, single-use consumption, and deny-by-default behavior.

What changed

  • Activated exactly artifact.verification.execute,
    artifact.pending_work.scan, and artifact.put_attempt.resolve.
  • Added closed typed ART contexts and a prepared-authority adapter that binds
    action, service profile/link, exact resource, fence facts, request digest,
    transaction, and idempotency scope.
  • Required claim authorization and commit before provider I/O, followed by a
    fresh terminal authorization consumed atomically with evidence and state.
  • Bound scanner authority to the exact cutoff, kind, page size, and final ID
    page, publishing only after commit.
  • Made direct fixed-service require calls deny; only valid prepared
    consumption can allow these actions.
  • Persisted the canonical resource-context digest in decision evidence and
    extended existing audit-fact constraints to admit only its strict form.
  • Routed Celery tasks through one composition adapter and added one scanner
    schedule.

Security and failure properties

Copied, replayed, cross-action, cross-resource, stale-fence, replaced-
transaction, revoked, suspended, or post-I/O stale handles deny. Failed claim,
terminal, scanner, evidence, or state mutations roll back and can be retried
without reusing consumed authority. Human and Operator authority is not
expanded; all other ART service actions remain planned and issue no handle.

Evidence

  • Migrated PostgreSQL internal-authorization suite: 9 passed.
  • Focused authorization, artifact architecture, recovery, and verification
    evidence passed, including relationship conflict and scanner rollback.
  • Migration clean upgrade/downgrade passed; downgrade refuses forward evidence.
  • Ruff, stale scans, markdown links, lightweight gates, lane inventory, and
    diff checks passed.
  • Required internal reviewers passed; reuse/dedup recorded only low residual
    risk.
  • GitHub Actions will run the full repository suite and coverage at the exact PR
    head; no local four-hour full run is required.

Human review focus

Confirm the three-action activation boundary, claim/provider/terminal ordering,
exact scanner page binding, public clean-denial restaging, and strict audit
digest persistence. The user retains merge approval for this specific PR.

Next gate

WS-XINT-002-04 is only the declared same-initiative successor. It does not
start automatically and requires a fresh explicit trusted-main event.

Summary by CodeRabbit

  • New Features
    • Activated internal artifact verification, put-attempt resolution, and pending-work scanning.
    • Added scheduled pending-work scans and integrated artifact runtime setup/teardown into worker lifecycle.
  • Bug Fixes
    • Improved staged authorization flow with rollback-safe consume behavior and denial restaging rules.
    • Enforced privacy-bounded resource_context_digest validation in authorization audit evidence.
  • Documentation
    • Updated activation boundaries, PREP/denial runbook guidance, and action availability/scan cadence specs.
  • Tests
    • Added dedicated internal authorization and audit validation coverage, updated migration expectations, and expanded worker scheduling and rollback scenarios.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Abiorh001, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 81a94b54-b0ce-432b-a92f-4e1b9f376c70

📥 Commits

Reviewing files that changed from the base of the PR and between d0d0a95 and 90bf971.

📒 Files selected for processing (3)
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.md
  • backend/tests/test_artifact_verification.py
📝 Walkthrough

Walkthrough

This PR activates three ART fixed-service actions through prepared authorization, adds transaction-bound claim and terminal consumption, persists digest-bound audit evidence, wires Celery runtime and pending-work scheduling, and adds PostgreSQL, orchestration, worker, documentation, and review validation.

Changes

Artifact authorization and execution

Layer / File(s) Summary
Authorization contracts and evidence
backend/app/modules/authorization/*, backend/app/modules/audit/*, backend/alembic/versions/0037...
Adds typed ART resource contexts, ARTIFACT_INTERNAL scopes, fixed-service matching, three active actions, public denial restaging, and resource_context_digest validation and persistence.
Prepared artifact authority and orchestration
backend/app/modules/artifacts/authorization.py, backend/app/modules/artifacts/service.py, backend/app/modules/artifacts/schemas.py
Introduces the ART-owned authority adapter and replaces preflight/terminal revalidation with phase-aware prepare, consume, and discard flows across claims, terminals, verification, and scans.
Worker and scheduler activation
backend/app/adapters/artifacts/internal_workers.py, backend/app/workers/artifacts.py, backend/app/workers/celery_app.py
Adds leased per-process artifact runtime management, authorized worker dispatch, pending-work publication, Celery lifecycle hooks, and a Beat schedule.
Activation and transaction validation
backend/tests/*, backend/scripts/run_test_lanes.py
Adds focused authority and PostgreSQL tests for exact resource consumption, rollback, denial restaging, stale fences, provider revocation, scanner publication, runtime lifecycle, and action availability.
Operational contract and review records
.agent-loop/..., docs/*
Updates activation requirements, operational specifications, verification commands, trust-bundle evidence, review records, migration expectations, and merge-intent metadata.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CeleryBeat
  participant ArtifactTask
  participant InternalRuntime
  participant PreparedAuthority
  participant ArtifactOrchestrator
  participant AuditStore
  CeleryBeat->>ArtifactTask: schedule pending-work scan
  ArtifactTask->>InternalRuntime: acquire leased artifact runtime
  InternalRuntime->>PreparedAuthority: prepare fixed-service authority
  PreparedAuthority->>ArtifactOrchestrator: authorize claim or scan
  ArtifactOrchestrator->>PreparedAuthority: consume final facts
  PreparedAuthority->>AuditStore: stage digest-bound evidence
  ArtifactTask->>ArtifactTask: publish committed follow-up work
Loading

Possibly related PRs

Suggested reviewers: abiorh-claw

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning It covers the goal and key changes, but omits most required template sections like scope control, evidence commands, test delta, and reviewer tables. Fill out the full PR trust-bundle template, especially intent/planning context, why/design/alternatives, scope, evidence, test delta, reviewer results, CI integrity, and merge ownership.
Docstring Coverage ⚠️ Warning Docstring coverage is 19.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: activation of internal artifact services.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-xint-002-03-internal-service-activation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 5

🧹 Nitpick comments (7)
backend/app/modules/authorization/kernel.py (1)

517-532: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Confirm the direct require() path for fixed services still denies by design.

_service_denial now takes resource but never reads it, so every direct require() for an active artifact action returns RESOURCE_GUARD_DENIED regardless of a well-formed resource context. That matches the stated deny-unless-prepared intent, but the unused parameter makes the contract implicit — worth a short comment on _service_denial (or dropping the parameter) so a future change doesn't silently start honoring it.

Also applies to: 609-609

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/app/modules/authorization/kernel.py` around lines 517 - 532, The
direct require() path for fixed services must continue denying artifact actions
unless the prepared resource context passes the existing guard. In
_service_denial, document that the resource parameter is intentionally unused
and that direct authorization denies by design, or remove the parameter and
update its callers consistently; do not change the current denial behavior.
backend/app/modules/authorization/prepared.py (1)

247-263: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pair each artifact action with its exact resource context type.

The current check accepts any of the three contexts for any of the three actions. The kernel independently enforces the action↔resource-type pairing (_ARTIFACT_INTERNAL_RESOURCES), so this isn't exploitable today, but deriving the scope from an unmatched pair here makes this seam depend on a downstream guard.

♻️ Tighten to the exact pairing
-        if action_id in {
-            ActionId.ARTIFACT_PUT_ATTEMPT_RESOLVE,
-            ActionId.ARTIFACT_VERIFICATION_EXECUTE,
-            ActionId.ARTIFACT_PENDING_WORK_SCAN,
-        } and isinstance(
-            resource,
-            (
-                ArtifactPutAttemptResourceContext,
-                ArtifactVerificationJobResourceContext,
-                ArtifactPendingWorkResourceContext,
-            ),
-        ):
+        artifact_resource = {
+            ActionId.ARTIFACT_PUT_ATTEMPT_RESOLVE: ArtifactPutAttemptResourceContext,
+            ActionId.ARTIFACT_VERIFICATION_EXECUTE: ArtifactVerificationJobResourceContext,
+            ActionId.ARTIFACT_PENDING_WORK_SCAN: ArtifactPendingWorkResourceContext,
+        }.get(action_id)
+        if artifact_resource is not None and isinstance(resource, artifact_resource):
             return PreparedAuthorityScope(
                 kind=PreparedAuthorityScopeKind.ARTIFACT_INTERNAL,
                 artifact_resource_type=resource.resource_type,
                 artifact_resource_id=resource.resource_id,
             )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/app/modules/authorization/prepared.py` around lines 247 - 263, Update
the artifact branch in the prepared authority scope logic to require exact
action-to-resource-context pairings: ARTIFACT_PUT_ATTEMPT_RESOLVE with
ArtifactPutAttemptResourceContext, ARTIFACT_VERIFICATION_EXECUTE with
ArtifactVerificationJobResourceContext, and ARTIFACT_PENDING_WORK_SCAN with
ArtifactPendingWorkResourceContext. Preserve the existing PreparedAuthorityScope
construction for matched pairs and reject unmatched combinations.
backend/app/modules/artifacts/service.py (1)

552-568: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Extract the repeated terminal-authorization preamble. Six terminal paths now duplicate the same sequence — prepare(phase="terminal", idempotency_key=executor_id), fence check → discard() + "stale", recompute facts → discard() + "stale", then consume(). A future change to this authorization guard has to land identically in all six, and a miss silently weakens one terminal path.

  • backend/app/modules/artifacts/service.py#L552-L568: extract the put-side preamble into one helper (e.g. returning the locked attempt and terminal facts, or a "stale" sentinel) and call it here.
  • backend/app/modules/artifacts/service.py#L706-L724: replace the inline preamble in _record_put_unavailable with the shared put helper.
  • backend/app/modules/artifacts/service.py#L750-L768: replace the inline preamble in _record_put_absence with the shared put helper.
  • backend/app/modules/artifacts/service.py#L858-L876: replace the inline preamble in _record_put_terminal_observation with the shared put helper.
  • backend/app/modules/artifacts/service.py#L967-L991: extract the verification-side variant (job/replica/attempt lock plus "conflict" branch) and call it here.
  • backend/app/modules/artifacts/service.py#L1025-L1049: reuse that verification helper in _complete_verification.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/app/modules/artifacts/service.py` around lines 552 - 568, Extract the
duplicated terminal authorization guards into shared helpers in service.py:
create a put-side helper covering terminal prepare, attempt locking, fence/facts
validation, discard, and "stale" handling, then reuse it in the anchor 552-568
and sibling sites 706-724, 750-768, and 858-876. Create a verification-side
helper covering job/replica/attempt locking and the existing "conflict" branch,
then reuse it at 967-991 and 1025-1049; preserve each path’s existing consume
behavior and outcomes.
.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md (1)

23-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the exact worker path in the allowlist.

wor?ers is a single-character wildcard, not the literal workers directory, so similarly named paths could also match. Use the exact path unless the gate intentionally requires this broader pattern.

Suggested fix
-backend/app/wor?ers/{artifacts,celery_app}.py
+backend/app/workers/{artifacts,celery_app}.py
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
@.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
at line 23, Update the worker allowlist entry referencing
backend/app/wor?ers/{artifacts,celery_app}.py to use the literal workers
directory path, removing the single-character wildcard so only the intended
worker files match.
backend/app/workers/artifacts.py (1)

37-62: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No retry/backoff policy on the newly-activated fixed-service tasks.

resolve_put_attempt, verify_object, and scan_pending_work now execute real authorization + I/O work but have no autoretry_for/retry_backoff/max_retries configured, so any transient failure (DB blip, denial due to a suspended actor, etc.) surfaces as a bare Celery task failure. For scan_pending_work specifically, a persistently denied scheduler identity would fail on every beat tick, generating recurring alert noise.

Consider adding an explicit retry policy (e.g., autoretry_for=(...), bounded max_retries, exponential retry_backoff) to these tasks, consistent with the rationale for choosing Celery.

As per coding guidelines: "use Celery or an equivalent durable worker when retries, scheduling, isolation, or distributed execution are needed."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/app/workers/artifacts.py` around lines 37 - 62, Add an explicit
bounded Celery retry policy to resolve_put_attempt, verify_object, and
scan_pending_work, including the appropriate transient exception scope,
exponential retry_backoff, and max_retries. Ensure persistent authorization
failures do not retry indefinitely or generate unbounded scheduler alert noise.

Source: Coding guidelines

backend/tests/test_artifact_internal_authorization.py (1)

495-499: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Test depends on a private module helper.

artifact_authorization._resource_context is private; if it is the canonical way to derive the digest for a decision, consider exposing a small public helper so the assertion doesn't break on internal refactors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_artifact_internal_authorization.py` around lines 495 -
499, Replace the test’s direct use of the private
artifact_authorization._resource_context helper with a small public helper that
exposes the canonical resource-context digest derivation, then update the
assertion to call that public API while preserving the existing expected digest
behavior.
backend/tests/test_artifact_verification.py (1)

56-69: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Beat-schedule assertions depend on import order.

importlib.import_module returns the already-imported module when another test imported app.workers.celery_app first, so setting WORKSTREAM_CELERY_TASK_ALWAYS_EAGER here can be a no-op and the asserted schedule reflects whatever settings were active at first import. Consider importlib.reload after the env change if the eager setting matters for these assertions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_artifact_verification.py` around lines 56 - 69, Update
test_internal_celery_tasks_and_pending_scan_are_registered_once to reload the
already-imported app.workers.celery_app module after setting
WORKSTREAM_CELERY_TASK_ALWAYS_EAGER and clearing get_settings, ensuring
celery_app and its beat_schedule reflect the test’s environment rather than
import order.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
@.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md:
- Around line 135-143: Replace the literal ${EMPTY} placeholders in the backend
coverage command with the correct app.workers.artifacts and
app.workers.celery_app module paths, while leaving the surrounding pytest
coverage options unchanged.

In `@backend/app/adapters/artifacts/internal_workers.py`:
- Around line 36-56: Move ArtifactStoreBootstrap creation and provider-store
initialization out of each task execution into Celery worker process lifecycle
hooks, such as worker_process_init and worker_process_shutdown. Update
resolve_put_attempt and verify_object to reuse the process-scoped initialized
store and namespace claim instead of creating or closing them per task; ensure
shutdown occurs only in the process shutdown hook and cannot race with active
task usage.

In `@backend/app/modules/artifacts/authorization.py`:
- Around line 237-250: Update _scope to catch malformed resource IDs and any
validation failure from PreparedAuthorityScope construction, then convert them
to the seam’s established AuthorizationDenied error type. Preserve valid UUID
normalization and pending-work handling while ensuring invalid selectors fail
closed as authorization denials.

In `@backend/tests/test_artifact_recovery.py`:
- Around line 76-78: Update _DenyTerminalArtifactAuthority.consume to inspect
the recorded transaction phase and raise ArtifactAuthorityDeniedError only
during the terminal phase, while delegating claim-phase consumption to the
inherited implementation. Match the phase-gating behavior used by
_RevokeTerminalArtifactAuthority so recovery reaches the terminal transaction.

In `@docs/spec_authorization_service.md`:
- Around line 623-632: Align the PREP denial contract across both
specifications: in docs/spec_authorization_service.md (lines 623-632),
explicitly document the ART clean-transaction denial-restage exception; in
docs/operations_authorization_service.md (lines 783-790), remove the claim that
planned fixed-service denials have no evidence or final resource context, since
the adapter calls require(), retains the denial, and supports clean restaging.
Do not change the adapter unless choosing instead to short-circuit before
require().

---

Nitpick comments:
In
@.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md:
- Line 23: Update the worker allowlist entry referencing
backend/app/wor?ers/{artifacts,celery_app}.py to use the literal workers
directory path, removing the single-character wildcard so only the intended
worker files match.

In `@backend/app/modules/artifacts/service.py`:
- Around line 552-568: Extract the duplicated terminal authorization guards into
shared helpers in service.py: create a put-side helper covering terminal
prepare, attempt locking, fence/facts validation, discard, and "stale" handling,
then reuse it in the anchor 552-568 and sibling sites 706-724, 750-768, and
858-876. Create a verification-side helper covering job/replica/attempt locking
and the existing "conflict" branch, then reuse it at 967-991 and 1025-1049;
preserve each path’s existing consume behavior and outcomes.

In `@backend/app/modules/authorization/kernel.py`:
- Around line 517-532: The direct require() path for fixed services must
continue denying artifact actions unless the prepared resource context passes
the existing guard. In _service_denial, document that the resource parameter is
intentionally unused and that direct authorization denies by design, or remove
the parameter and update its callers consistently; do not change the current
denial behavior.

In `@backend/app/modules/authorization/prepared.py`:
- Around line 247-263: Update the artifact branch in the prepared authority
scope logic to require exact action-to-resource-context pairings:
ARTIFACT_PUT_ATTEMPT_RESOLVE with ArtifactPutAttemptResourceContext,
ARTIFACT_VERIFICATION_EXECUTE with ArtifactVerificationJobResourceContext, and
ARTIFACT_PENDING_WORK_SCAN with ArtifactPendingWorkResourceContext. Preserve the
existing PreparedAuthorityScope construction for matched pairs and reject
unmatched combinations.

In `@backend/app/workers/artifacts.py`:
- Around line 37-62: Add an explicit bounded Celery retry policy to
resolve_put_attempt, verify_object, and scan_pending_work, including the
appropriate transient exception scope, exponential retry_backoff, and
max_retries. Ensure persistent authorization failures do not retry indefinitely
or generate unbounded scheduler alert noise.

In `@backend/tests/test_artifact_internal_authorization.py`:
- Around line 495-499: Replace the test’s direct use of the private
artifact_authorization._resource_context helper with a small public helper that
exposes the canonical resource-context digest derivation, then update the
assertion to call that public API while preserving the existing expected digest
behavior.

In `@backend/tests/test_artifact_verification.py`:
- Around line 56-69: Update
test_internal_celery_tasks_and_pending_scan_are_registered_once to reload the
already-imported app.workers.celery_app module after setting
WORKSTREAM_CELERY_TASK_ALWAYS_EAGER and clearing get_settings, ensuring
celery_app and its beat_schedule reflect the test’s environment rather than
import order.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b1f429b-40ec-406c-9723-a68a8a053bf1

📥 Commits

Reviewing files that changed from the base of the PR and between f4cebb0 and ccb0249.

📒 Files selected for processing (31)
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/DISCOVERY.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/REVIEW_LOG.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-internal-review.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.md
  • .agent-loop/merge-intents/WS-XINT-002-03.json
  • backend/alembic/versions/0037_artifact_authorization_context_evidence.py
  • backend/app/adapters/artifacts/internal_workers.py
  • backend/app/modules/artifacts/authorization.py
  • backend/app/modules/artifacts/schemas.py
  • backend/app/modules/artifacts/service.py
  • backend/app/modules/audit/schemas.py
  • backend/app/modules/authorization/catalogue.py
  • backend/app/modules/authorization/kernel.py
  • backend/app/modules/authorization/prepared.py
  • backend/app/modules/authorization/runtime.py
  • backend/app/workers/artifacts.py
  • backend/app/workers/celery_app.py
  • backend/scripts/run_test_lanes.py
  • backend/tests/conftest.py
  • backend/tests/test_artifact_admission.py
  • backend/tests/test_artifact_authorization.py
  • backend/tests/test_artifact_internal_authorization.py
  • backend/tests/test_artifact_recovery.py
  • backend/tests/test_artifact_verification.py
  • backend/tests/test_audit.py
  • backend/tests/test_authorization.py
  • docs/operations_artifact_storage.md
  • docs/operations_authorization_service.md
  • docs/spec_artifact_storage_service.md
  • docs/spec_authorization_service.md

Comment thread backend/app/adapters/artifacts/internal_workers.py
Comment thread backend/app/modules/artifacts/authorization.py Outdated
Comment thread backend/tests/test_artifact_recovery.py Outdated
Comment thread docs/spec_authorization_service.md Outdated

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/app/workers/celery_app.py`:
- Around line 25-34: Update the artifact runtime lifecycle around
initialize_artifact_runtime_for_process, shutdown_artifact_runtime_for_process,
and the artifact Celery task entry points so eager and non-prefork execution
initializes the runtime before _artifact_internal_runtime() is accessed. Use an
initialization path that cannot be skipped outside prefork signals, while
preserving per-process setup and shutdown behavior; add coverage that runs the
actual tasks with task_always_eager enabled without monkeypatching their bodies.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 274d8718-dbe2-4556-9569-eda0ff4cca6f

📥 Commits

Reviewing files that changed from the base of the PR and between ccb0249 and 74370da.

📒 Files selected for processing (13)
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/REVIEW_LOG.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.md
  • backend/app/adapters/artifacts/internal_workers.py
  • backend/app/modules/artifacts/authorization.py
  • backend/app/workers/celery_app.py
  • backend/tests/test_artifact_admission.py
  • backend/tests/test_artifact_internal_authorization.py
  • backend/tests/test_artifact_recovery.py
  • backend/tests/test_artifact_verification.py
  • backend/tests/test_authorization.py
  • docs/operations_authorization_service.md
  • docs/spec_authorization_service.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • backend/tests/test_artifact_recovery.py
  • docs/spec_authorization_service.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
  • backend/tests/test_artifact_admission.py
  • docs/operations_authorization_service.md
  • backend/tests/test_authorization.py
  • backend/app/modules/artifacts/authorization.py
  • backend/tests/test_artifact_internal_authorization.py

Comment thread backend/app/workers/celery_app.py

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
backend/tests/test_artifact_verification.py (1)

70-162: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Always clear the settings cache during teardown.

If this test fails before Line 162, monkeypatch restores the environment but get_settings() can remain cached with eager-mode settings, contaminating later tests. Wrap the body after the initial cache clear in try/finally and clear the cache in finally.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_artifact_verification.py` around lines 70 - 162, Ensure
the test body after the initial get_settings.cache_clear() is enclosed in a
try/finally block, and call get_settings.cache_clear() in the finally clause so
the cache is cleared even when assertions or setup fail. Remove reliance on the
final cleanup call at the end of the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
@.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.md:
- Around line 65-80: Update the artifact-foundation coverage work and its
validation evidence so the materially changed artifact subsystem reaches at
least the required 90% floor, rather than documenting the current 89.42% result
as acceptable. Add targeted tests for the uncovered paths near the existing
coverage additions, rerun the artifact coverage gate, and record the passing
result before sign-off.

---

Outside diff comments:
In `@backend/tests/test_artifact_verification.py`:
- Around line 70-162: Ensure the test body after the initial
get_settings.cache_clear() is enclosed in a try/finally block, and call
get_settings.cache_clear() in the finally clause so the cache is cleared even
when assertions or setup fail. Remove reliance on the final cleanup call at the
end of the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c1b92141-3726-471a-81f9-0edb690aa2a3

📥 Commits

Reviewing files that changed from the base of the PR and between 74370da and d0d0a95.

📒 Files selected for processing (10)
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.md
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.md
  • backend/app/adapters/artifacts/internal_workers.py
  • backend/app/modules/authorization/kernel.py
  • backend/app/modules/authorization/prepared.py
  • backend/app/workers/celery_app.py
  • backend/tests/test_alembic.py
  • backend/tests/test_artifact_internal_authorization.py
  • backend/tests/test_artifact_verification.py
🚧 Files skipped from review as they are similar to previous changes (7)
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.md
  • backend/app/workers/celery_app.py
  • backend/app/modules/authorization/prepared.py
  • backend/app/modules/authorization/kernel.py
  • backend/tests/test_artifact_internal_authorization.py
  • .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
  • backend/app/adapters/artifacts/internal_workers.py

@abiorh-claw
abiorh-claw self-requested a review July 28, 2026 01:46
@abiorh-claw
abiorh-claw merged commit 4336664 into main Jul 28, 2026
3 checks passed
@abiorh-claw
abiorh-claw deleted the codex/ws-xint-002-03-internal-service-activation branch July 28, 2026 02:23
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