Feature/face detection multi roll conflict#26
Merged
Conversation
added 3 commits
May 20, 2026 12:07
…ayer
Implements Issue 1: a durable, replay-safe session state manager for the
MAIN Agent. The module encapsulates four sub-layers:
Models (models/)
session_state.py — SessionLifecycleStage (7-stage FSM enum),
SessionState (JSON-serialisable durable fragment),
RecordedQuestion/Response, WeakAreaRecord,
ContradictionEntry, FollowUpRecord
transcript_entry.py — TranscriptEntry with examiner_question /
candidate_response factory helpers
coverage_state.py — CoverageState + TopicCoverage, recompute_percentage,
get_uncovered_planned_topics
Session (session/)
history.py — SessionHistory: OrderedDict-backed, turn-index keyed,
deduplication-guarded Q/A store
transitions.py — TransitionManager FSM (13 valid edges),
InvalidTransitionError, is_terminal
state.py — VivaSessionState: MAIN-owned facade combining
_state / _history / _coverage
persistence.py — SessionPersistence generic adapter with
in_memory_persistence() and file_system_persistence()
factories — no direct FS/DB coupling
All mutation is explicit via method calls; FSM raises InvalidTransitionError
on illegal edges. All state classes are dataclass-backed with to_dict() /
from_dict() / to_json() / from_json(), making them independently testable
without the full viva stack. FollowUpRecord.add_turn() deduplicates on
repeated calls, keeping replay order stable across save/load cycles.
- Add FaceDetectionService for comparing face embeddings via cosine similarity - Detect same-face usage across multiple roll numbers - Generate conflict alerts for suspicious identity reuse - Prevent automatic access on pending review conflicts - Add API endpoints for face verification and alert management - Add comprehensive test coverage for all acceptance criteria
…n-multi-roll-conflict
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds face-embedding based identity verification with conflict alerting (multi roll-number detection), exposes it via API/agent events, and introduces a new VivaSessionManager state/history/persistence layer.
Changes:
- Implement in-memory face embedding store with cosine-similarity conflict detection + alert lifecycle.
- Add FastAPI endpoints and onboarding-agent event emission around face verification + manual review workflow.
- Add new VivaSessionManager modules for session state, transitions, persistence, and transcript records.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/src/services/face_detection.py | New face verification service, conflict alert model, and access gating logic |
| backend/tests/test_face_detection.py | Pytest coverage for face detection behaviors (add/verify/conflict/resolve) |
| backend/src/main.py | Adds /face/* endpoints and request models wired to the face service |
| backend/src/agents/onboarding.py | Integrates face verification into onboarding flow and emits new events |
| backend/src/models/events.py | Adds new event types for face detection + manual review workflow |
| backend/src/agents/main_agent/VivaSessionManager/session/transitions.py | Adds explicit FSM transition validation utilities |
| backend/src/agents/main_agent/VivaSessionManager/session/state.py | Adds top-level viva session state facade (history/coverage/persistence) |
| backend/src/agents/main_agent/VivaSessionManager/session/persistence.py | Adds persistence adapter + in-memory / filesystem factories |
| backend/src/agents/main_agent/VivaSessionManager/session/history.py | Adds deterministic question/response history store |
| backend/src/agents/main_agent/VivaSessionManager/session/init.py | Exposes session-layer public API |
| backend/src/agents/main_agent/VivaSessionManager/models/session_state.py | Adds JSON-serializable session state + record types |
| backend/src/agents/main_agent/VivaSessionManager/models/coverage_state.py | Adds topic coverage tracker |
| backend/src/agents/main_agent/VivaSessionManager/models/transcript_entry.py | Adds transcript entry model + helpers |
| backend/src/agents/main_agent/VivaSessionManager/models/init.py | Exposes model-layer public API |
| backend/src/agents/main_agent/VivaSessionManager/init.py | Package public API exports for VivaSessionManager |
Comments suppressed due to low confidence (1)
backend/src/services/face_detection.py:1
suspiciousis annotated asDict[str, List[str]]but uses tuple keys, which breaks the type contract and also makes it non-JSON-serializable (tuple keys become invalid for JSON responses). Use a string key (e.g., a stable joined key like'R001|R002'), or return a list of structured objects instead.
from typing import Optional, List, Dict, Any, Tuple
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 14:59
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:00
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:00
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:00
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:03
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:03
Copilot stopped work on behalf of
Soldier224K due to an error
May 22, 2026 15:11
Contributor
|
@Soldier224K please attach the PR you’re working on |
Collaborator
Author
|
Issue 5 :- Face detection conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #19