fix: Role(str) has no attribute .value — ctx.role.value AttributeError
fix: Role(str) has no attribute '.value' — AttributeError at 10 call sites
Bug Description
Role class in openviking/server/identity.py extends str:
class Role(str):
ROOT = "root"
But 10 call sites across 6 files call ctx.role.value, which fails with:
'str' object has no attribute 'value'
This was likely introduced when Role migrated from Enum to str.
Impact
- memory_extraction fails:
session.py:1329triggers every commit, blockingafterTurnarchive flow →FAILED_PRECONDITION - 9 other code paths silently broken (resource_service, content_write, reindex_executor, fs_service, summarizer)
Affected Files (6 files, 10 call sites)
| File | Lines | Count |
|---|---|---|
session.py |
1329 | 1 |
content_write.py |
469 | 1 |
reindex_executor.py |
568 | 1 |
fs_service.py |
334 | 1 |
resource_service.py |
954,967,988,1016,1023 | 5 |
summarizer.py |
121 | 1 |
Fix
Replace ctx.role.value → str(ctx.role) at all 10 sites. Since Role(str), str(ctx.role) is semantically equivalent and safe.
Reproduction
- Set
vlm.model = "MiniMax-M2.7-highspeed"in ov.conf - Trigger
POST /api/v1/sessions/{id}/commit - Memory extraction fails with
'str' object has no attribute 'value' - Subsequent commits blocked:
FAILED_PRECONDITION: unresolved failed archive
Related
Follow-up to PR #2619 — both are OV 0.4.4 VLM compatibility bugs at different code paths.
Update: this bug has already been fixed in main (all 10 call sites use str(ctx.role)), but the fix hasn't been released as a pip package yet — the current 0.4.4 release still has the old ctx.role.value pattern.
Verified: all 6 files / 10 lines already have str(ctx.role) on main:
session.py:1329✅content_write.py:469✅reindex_executor.py:568✅fs_service.py:334✅resource_service.py:954,967,988,1016,1023✅summarizer.py:121✅
The local workaround (applying the fix manually) is needed until 0.4.5 is released. No PR needed — closing suggestion: keep issue open as release-tracking for 0.4.5+.
Confirming this on a clean install of the released 0.4.4 (from PyPI), with vlm.model = "gpt-4o-mini" — so it's not specific to MiniMax/MiniMax-style models. Any commit that triggers memory extraction hits it:
ERROR - Memory extraction failed for session cc-...
Traceback (most recent call last):
File ".../openviking/session/session.py", line 1329, in _run_memory_extraction
"role": self.ctx.role.value,
^^^^^^^^^^^^^^^^^^^
AttributeError: 'Role' object has no attribute 'value'
It fires from the if redo_enabled: (redo-log) branch, which is on by default, so every POST /api/v1/sessions/{id}/commit fails extraction and total_memories stays 0.
Note main already has session.py:1329 fixed to str(self.ctx.role), but that fix isn't in any published release yet (latest on PyPI is still 0.4.4), so everyone installing from PyPI hits this. A release including the str(ctx.role) change at all 10 call sites would be much appreciated. 🙏
Workaround for anyone blocked meanwhile: add a value property to Role in server/identity.py:
@property
def value(self) -> str:
return str(self)
which fixes all 10 sites at once without touching each call site.
Thanks for reporting this!
This has already been fixed on main by #2728 (79f7bdd1, fix(auth): align role serialization with string roles). The fix replaced the stale enum-style role serialization with string serialization and updated the related role reconstruction paths.
Fixed areas:
openviking/session/session.py: redo-log payload now writesstr(self.ctx.role)instead ofself.ctx.role.value.openviking/storage/content_write.py: semantic refresh messages now serializerole=str(ctx.role).openviking/service/fs_service.py: filesystem semantic refresh enqueue now serializesrole=str(ctx.role).openviking/service/reindex_executor.py: reindex semantic messages now serializerole=str(ctx.role).openviking/service/resource_service.py: watch task lookup/update/create/cancel paths now usestr(ctx.role)/original_role=str(ctx.role).openviking/utils/summarizer.py: summarization semantic messages now serializerole=str(ctx.role).openviking/resource/watch_scheduler.py: fallback role values now usestr(Role.USER).openviking/storage/queuefs/semantic_processor.py: semantic queue context reconstruction now usesRole(msg.role or Role.ROOT), so custom string roles are preserved instead of relying on enum.value.
Validation from #2728 included identity and semantic processor regression coverage, and I also re-ran the focused tests locally:
uv --cache-dir /private/tmp/openviking-uv-cache run pytest tests/server/test_identity.py tests/storage/test_semantic_processor_identity.py
Result: 8 passed.
Closing this as fixed on main. Users installing the current PyPI 0.4.4 release may still hit this until a release containing #2728 is published.