Skip to content

fix: auto authority under lock; strict blocked_indices (#31/#32 follow-up) - #33

Merged
JustinJLeopard merged 1 commit into
demo-buildfrom
fable/pr31-pr32-followup-auto-authority
Aug 10, 2026
Merged

fix: auto authority under lock; strict blocked_indices (#31/#32 follow-up)#33
JustinJLeopard merged 1 commit into
demo-buildfrom
fable/pr31-pr32-followup-auto-authority

Conversation

@JustinJLeopard

Copy link
Copy Markdown
Owner

Bounded follow-up preserving both outstanding items per Codex 2238/2250 reviews.

PR #31 P1s — explicit-false authority + concurrent env restoration:

  • run() exports JUSTAI_AUTO_MODE='1'/'0' for the whole run under a reentrant lock; exact prior restored on every path.
  • Effect tests: inherited-1+explicit-false, auto-true→nested auto-false, two overlapping runs (in-flight + final-state observations).

PR #32 P2_normalize_blocked_indices type discipline:

  • Only None = omitted; falsy malformed (False, 0, '', [], ()) and unsupported iterables raise ValueError.

Evidence: RED pre-fix (4 auto + 8 P2 failures) → GREEN; full suite 521 passed + 14 subtests.

Reviewer: Desktop Codex (exact-head review per writer-lease protocol).

🤖 Generated with Claude Code

https://claude.ai/code/session_01VPortjb8U5oteKxppGuVDQ

…_indices types (#31/#32 follow-up)

PR #31 P1s (Codex 2238):
- run(auto=...) is now AUTHORITATIVE: exports JUSTAI_AUTO_MODE='1'/'0' for the
  whole run, so explicit auto=False overrides an inherited '1' at the point the
  checkpoint actually reads it; exact prior state restored on every return path.
- Env-dependent run serialized under a reentrant lock: overlapping runs cannot
  interleave save/restore and corrupt the shared variable; nested runs on the
  same thread still work.
- RED-first effect tests: inherited-1 + explicit-false; auto-true -> nested
  auto-false; two overlapping runs with in-flight + final-state observations.

PR #32 P2 (Codex 2250):
- _normalize_blocked_indices: only None means omitted; falsy malformed values
  (False, 0, '', [], ()) and unsupported iterables now raise ValueError instead
  of silently meaning 'nothing blocked'.
- RED-first tests: parametrized malformed rejection; None/empty/valid semantics.

RED verified pre-fix (4 auto + 8 P2 failures); full suite 521 passed + 14 subtests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VPortjb8U5oteKxppGuVDQ
Copilot AI lite review requested due to automatic review settings August 10, 2026 00:47
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
justai-demo Ready Ready Preview Aug 10, 2026 12:47am

Request Review

@JustinJLeopard
JustinJLeopard merged commit 7cf99b2 into demo-build Aug 10, 2026
3 checks passed
@JustinJLeopard
JustinJLeopard deleted the fable/pr31-pr32-followup-auto-authority branch August 10, 2026 00:47

Copilot AI 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.

Pull request overview

Follow-up fix to harden orchestration “auto mode” behavior and dependency-indexing validation, addressing prior review findings from PRs #31 and #32. It makes auto authoritative for checkpoint reads (without env leakage or concurrency races) and tightens blocked_indices normalization to reject malformed/unsupported inputs rather than silently treating them as “nothing blocked.”

Changes:

  • Serialize JUSTAI_AUTO_MODE save/set/restore for the full run() execution under a re-entrant lock; export "1" for auto=True and "0" for auto=False, restoring the exact prior state afterward.
  • Enforce strict type discipline in _normalize_blocked_indices: only None means “omitted”; non-set/dict inputs now raise ValueError.
  • Add regression tests covering explicit-false authority, nested runs, overlapping runs, and blocked_indices type/normalization behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
justai/orchestrator.py Adds _RUN_ENV_LOCK and scopes JUSTAI_AUTO_MODE under lock for the entire run with exact restoration.
justai/agent_dispatch.py Tightens _normalize_blocked_indices to treat only None as omitted and reject unsupported types early.
tests/test_auto_mode_scope.py Adds tests for authoritative auto=false behavior, nested runs, lock holding, and overlapping run serialization.
tests/test_completion_integrity.py Adds tests asserting strict blocked_indices type/normalization rules.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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