Repository navigation
refactor: consolidate operator recovery admission - #166759
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 6:12 PM ET / 22:12 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR consolidates operator model-policy preparation, derives restart-recovery types from existing validation schemas, and captures recovery facts before issuing one host authority. Merge readiness✅ Ready for maintainer review This remains a useful maintainer-authored cleanup that current main does not contain. No actionable correctness or security defect was found; ordinary exact-head CI and landing gates remain. Priority: P3 Review scores
Verification
How this fits togetherOperator admission carries an authenticated caller’s permissions into agent execution. Restart recovery uses the captured source facts to restore interrupted work under current policy while preserving the original permission ceilings. flowchart TD
A[Authenticated operator input] --> B[Prepare admission facts]
B --> C[Capture recovery snapshot]
C --> D[Issue host authority]
D --> E[Agent execution]
C --> F[Restart recovery]
F --> G[Current policy and original ceilings]
G --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -29, Tests +8. Total -21 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one admission-policy reader and schema-owned recovery types while preserving live revocation, source custody, and both model ceilings. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR preserves existing behavior rather than reporting a new defect; source inspection and the extended boundary test establish the intended invariants. Is this the best way to solve the issue? Yes: consolidating existing preparation and deriving types from their validation owner removes duplication without adding another authority or changing the recovery contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 90d30a1178a7. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
e363308 to
4c9512f
Compare
Related: #166553 — preserve authenticated operator access after Control UI restart recovery.
What Problem This Solves
Maintainer-requested follow-up removes duplicate model-policy preparation, recovery type definitions, and authority construction from the merged restart-recovery repair.
User Impact
No user-visible behavior change. Automatic recovery retains the original authenticated basis and scope/model ceilings; source-less claims remain restricted. No new durable fields, configuration options, SQLite schema/version, migration, protocol, or setup action.
Why This Change Was Made
Production LOC: +99/-128 (net -29). Tests: +8/-0. No generated, lockfile, or documentation changes.
Intentional repetition retained: identity/source checks around policy callbacks, subscriptions before awaited preparation, exact source-claim reread, original/re-admission/current model ceilings, and first resumed access-owner retention. These protect observable revocation and ordering contracts rather than duplicating policy.
Evidence
pnpm build: passed (exit 0). Changed-check guards, formatting, production/test typing, and dead-export scans passed. Full core lint found two shadowed local names in the new call site; after renaming the binding, focused typed lint and production typing passed (exit 0). No remaining accepted/actionable findings.git range-diffreports=) onto38c96048a56, which only changes unrelated CLI schema handling. Published head:e3633085263fd4524699096cbf8f2e40b8304d55.Focused validation commands
node scripts/run-vitest.mjs src/gateway/operator-run-authority.worker.test.ts src/gateway/operator-run-recovery.test.ts src/gateway/server-methods/cron-creator-transports.integration.test.ts src/gateway/server-instance-runtime.operator-recovery.test.ts src/agents/operator-model-policy.test.ts src/gateway/operator-run-authority.module-identity.test.ts src/channels/message-access/participant-input.test.ts node scripts/check-changed.mjs pnpm build # Focused repeat after the lexical binding rename: node --import ./scripts/tsx.mjs scripts/run-oxlint.mts --tsconfig config/tsconfig/oxlint.core.json src/gateway/operator-run-authority.ts node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo .agents/skills/autoreview/scripts/autoreview --mode uncommittedCI Recovery
The original head
e3633085263fd4524699096cbf8f2e40b8304d55reproduced the five CI failures indirective-handling.mixed-inline.test.ts: session model selection now performs a placement read through the shared-state broker, but the test still ran in the thread-based auto-reply suite. The CI fail-fast job then cancelled the remaining selected lanes.Main already repaired the test owner in 3cbd049ccfd8: the three directive consumers run in the forked SQLite-host suite, preserving every assertion and production behavior. Rebased this follow-up onto
06a1b56f5c9b8d39ff895a6cb60ff5954a7160bb;git range-diffreports=. No additional production or test edits.Current head:
4c9512f595ab3f6a628c6d6dbcb5fc0b3bcf7ecf.Verification:
node scripts/run-vitest.mjs src/auto-reply/reply/directive-handling.mixed-inline.test.ts— 5 failed, 21 passed; same broker error as CI.node scripts/run-vitest.mjs src/auto-reply/reply/directive-handling.mixed-inline.test.ts src/auto-reply/reply/directive-handling.model.test.ts src/auto-reply/reply/get-reply-native-slash-fast-path.test.ts— 172 passed, wrapper exit 0 (84.51s).git diff --check— passed.Exact-head CI run 37693961635 completed successfully on
4c9512f595ab3f6a628c6d6dbcb5fc0b3bcf7ecf, including the previously failing shard, build, UI E2E, production/test typing, and lint. Prior-head CI remains prior-head evidence. PR remains unmerged.