Skip to content

Fix qualification session device reassociation - #6

Merged
whatobiplays merged 5 commits into
mainfrom
codex/qualification-session-device-reassociation
Aug 30, 2026
Merged

Fix qualification session device reassociation#6
whatobiplays merged 5 commits into
mainfrom
codex/qualification-session-device-reassociation

Conversation

@whatobiplays

@whatobiplays whatobiplays commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep persisted qualification device handles as historical capture metadata
  • establish restored-session device associations only through current-process SessionHandles after full target-fact validation
  • keep restored connected-device selection available while retaining plan and recipe locks
  • validate review and execution binding against the trusted live association
  • add restored and active same-process regression coverage, including connected-row accessibility

Validation

  • app Rust tests: 327 passed, 2 ignored
  • frontend tests: passed
  • typecheck, lint, and diff check: passed
  • make test reaches an unrelated existing synthetic qualification cleanup race (ENOTEMPTY in tampered existing evidence bundle report blocks both promotions before canonical mutation); that test passes in isolation

No physical qualification, evidence, matrix, target, recipe, or profile state was changed.


Summary by cubic

Fixes restored qualification sessions so they can reassociate with the current process's live device instead of failing against the stale persisted device handle.

Bug Fixes

  • Persisted session device handles are now historical metadata; SessionHandles owns the current-process session-to-device association.
  • Restored sessions keep device selection available; selection locks only after refresh validation matches every target fact, and a stale in-flight refresh can't lock a newly selected device.
  • Review binding, execution binding, and finalization require the trusted live association and reject the stale persisted handle.
  • The association is cleared when device authority is invalidated and when the candidate is discarded, finalized, or recorded.

New Features

  • Registered the first qualification target: ARBOR GT78-VN under the authored ayaneo.pocket_air_mini profile (non_root), marked unqualified in the matrix.
  • Non-root root checks (Denied) now register as non_root; only failed root checks block target capture.

Written for commit e4a6033. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 14 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/emuchef-app/src-tauri/src/handles.rs">

<violation number="1" location="apps/emuchef-app/src-tauri/src/handles.rs:73">
P2: Each qualification attempt leaves its session handle in this process-local map after discard or finalization. Add per-session removal when the candidate lifecycle ends, or bound this map like the other session stores.</violation>
</file>

<file name="apps/emuchef-app/src-tauri/src/qualification_mode.rs">

<violation number="1" location="apps/emuchef-app/src-tauri/src/qualification_mode.rs:1487">
P2: After a runtime-authority reset clears the process-local association, this lookup rejects an otherwise resumable session before it can re-establish its live device binding. Reassociate after authority reset, or make the binding flow trigger the full target validation when the association is absent.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/emuchef-app/src-tauri/src/handles.rs
Comment thread apps/emuchef-app/src-tauri/src/qualification_mode.rs Outdated
Comment thread apps/emuchef-app/src/useDeviceQualificationMode.ts
device_generation: u64,
session_epoch_by_handle: HashMap<String, u64>,
qualification_context_by_handle: HashMap<String, QualificationContextKey>,
qualification_device_by_session: HashMap<String, String>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Each qualification attempt leaves its session handle in this process-local map after discard or finalization. Add per-session removal when the candidate lifecycle ends, or bound this map like the other session stores.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/emuchef-app/src-tauri/src/handles.rs, line 73:

<comment>Each qualification attempt leaves its session handle in this process-local map after discard or finalization. Add per-session removal when the candidate lifecycle ends, or bound this map like the other session stores.</comment>

<file context>
@@ -70,6 +70,7 @@ pub struct SessionHandles {
     device_generation: u64,
     session_epoch_by_handle: HashMap<String, u64>,
     qualification_context_by_handle: HashMap<String, QualificationContextKey>,
+    qualification_device_by_session: HashMap<String, String>,
     last_inventory_count: Option<usize>,
 }
</file context>

.map_err(|_| safe_qualification_error("qualification_review_mismatch"))?;
let associated_device_handle = handles
.qualification_session_device_handle(&session_handle)
.ok_or_else(|| safe_qualification_error("qualification_review_mismatch"))?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: After a runtime-authority reset clears the process-local association, this lookup rejects an otherwise resumable session before it can re-establish its live device binding. Reassociate after authority reset, or make the binding flow trigger the full target validation when the association is absent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/emuchef-app/src-tauri/src/qualification_mode.rs, line 1487:

<comment>After a runtime-authority reset clears the process-local association, this lookup rejects an otherwise resumable session before it can re-establish its live device binding. Reassociate after authority reset, or make the binding flow trigger the full target validation when the association is absent.</comment>

<file context>
@@ -1414,14 +1477,22 @@ pub fn bind_qualification_review(
+            .map_err(|_| safe_qualification_error("qualification_review_mismatch"))?;
+        let associated_device_handle = handles
+            .qualification_session_device_handle(&session_handle)
+            .ok_or_else(|| safe_qualification_error("qualification_review_mismatch"))?
+            .to_string();
+        let review = handles
</file context>

Comment thread apps/emuchef-app/tests/App.dom.test.tsx Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 7 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/emuchef-app/src/useDeviceQualificationMode.ts Outdated
Comment thread apps/emuchef-app/tests/useDeviceQualificationMode.dom.test.tsx Outdated
@whatobiplays
whatobiplays merged commit 3cd70d9 into main Aug 30, 2026
7 checks passed
@whatobiplays
whatobiplays deleted the codex/qualification-session-device-reassociation branch August 30, 2026 10:36
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