Skip to content

Add canonical revisioned Codex role profiles - #9

Merged
Punisheroot merged 1 commit into
mainfrom
codex/issue-1-role-profiles
Aug 3, 2026
Merged

Add canonical revisioned Codex role profiles#9
Punisheroot merged 1 commit into
mainfrom
codex/issue-1-role-profiles

Conversation

@Punisheroot

Copy link
Copy Markdown
Contributor

Summary

Closes #1.

Adds the canonical, revisioned Codex role-profile domain and its local SQLite persistence boundary. Profiles can now be created, revised, activated, deactivated, retrieved historically, and resolved by digest without mixing role configuration into runtime settings or ModelPolicy.

Implementation

  • Defines the closed Codex role and policy vocabulary, bounded budgets, canonical route assignments, deterministic definition digests, and explicit projection to the existing WorkerProfile representation.
  • Rejects host paths, network access, credentials, and known credential-like model/profile/route values; enforces the raw eight-route input limit before canonical sort-and-deduplication.
  • Adds SQLite migration V14 with immutable definition revisions, generation-bound state digests, historical activation, append-only audit records, and transactional create/revise/state operations.
  • Fails closed when persisted latest/state metadata or canonical JSON is inconsistent, rather than silently repairing or reinterpreting history.
  • Keeps the slice offline and additive: it does not bind profiles to sessions/workers, alter provider calls, auto-select a profile, or change existing ModelPolicy behavior.

Validation

All commands below completed successfully from a clean detached worktree at commit 50cb649.

cd crates/needle-app/web && npm ci
passed; 415 packages installed (npm reported 2 existing high-severity audit findings)

cd crates/needle-app/web && npm test
passed; 1 test file, 2 tests

cd crates/needle-app/web && npm run lint
passed

cd crates/needle-app/web && npm run build
passed

rtk test cargo test --locked -p needle-core role_profile --lib
passed; 7 tests

rtk test cargo test --locked -p needle-runtime role_profiles --lib
passed; 6 tests

rtk test cargo test --locked --workspace
passed; all executed workspace tests passed, 1 test ignored

rtk test cargo clippy --locked --workspace --all-targets -- -D warnings
passed

rtk test cargo build --locked --workspace
passed

cargo fmt --all -- --check
passed

git diff --check
passed

Not run: Playwright end-to-end tests, live/provider smoke tests, and plugin packaging. This change does not modify their execution paths and the new role-profile boundary is not yet wired into live execution.

Risks/limitations

  • Migration V14 is additive and intentionally performs no backfill or automatic activation; existing installations start with no role profiles.
  • Revision and audit tables are append-only, so storage grows with profile changes.
  • Canonicalization is bounded to at most eight raw route assignments; sorting is O(R log R) within that fixed cap.
  • Credential rejection covers explicit fields and known credential-like prefixes; it is not entropy-based secret scanning.
  • The slice is an offline persistence boundary only: there is no HTTP/editor UI, worker/session binding, lifecycle executor, automatic activation, or non-Codex host support yet.
  • No runtime hot path, provider request, or network behavior is changed. The two npm audit findings reported by npm ci remain outside this patch.

Documentation/evidence

  • docs/CONFIGURATION.md documents the supported roles, policy bounds, canonical revision/state semantics, compatibility projection, and current offline boundary.
  • PROJECT_STATUS.md records canonical named Codex role profiles as implemented while leaving editor and live-binding work pending.
  • Focused tests cover canonical digests, route bounds, credential/path rejection, compatibility projection, immutable history, optimistic state transitions, rollback, audit records, historical activation, digest lookup, and corruption handling.

AI assistance and human verification

AI assistance: code, tests, documentation
Human verification: Reviewed the complete selectively scoped diff against issue #1 and the current repository source. Traced every canonical digest input and exclusion, the WorkerProfile compatibility projection, SQLite V14 constraints and triggers, transaction rollback paths, state-generation CAS, historical activation, corruption handling, and audit records. Reviewed the focused and workspace test coverage and confirmed that unrelated working-tree edits, generated assets, credentials, and live artifacts are excluded from the proposed commit.

AI was used only for code assistance.

Ownership checklist

  • I read and understand the complete diff and can explain every material change.
  • I personally verified the reported tests and technical or performance claims.
  • I finalized and personally published the commits and this pull request.
  • I checked for unrelated edits, credentials, generated files, and live artifacts.
  • Public documentation and PROJECT_STATUS.md are updated when applicable.

@Punisheroot
Punisheroot marked this pull request as ready for review August 3, 2026 17:20
@Punisheroot
Punisheroot merged commit 62d9f35 into main Aug 3, 2026
2 checks passed
@Punisheroot
Punisheroot deleted the codex/issue-1-role-profiles branch August 3, 2026 17:21
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.

Canonical revisioned Codex role-profile domain and SQLite persistence

1 participant