mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 00:45:54 +03:00
[PR #433] Persist content strategy runtime state in DB-backed SharedStateBackend #740
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#740
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/433
Author: @AJaySi
Created: 3/12/2026
Status: 🔄 Open
Base:
main← Head:codex/refactor-state-management-using-shared-backend📝 Commits (1)
f63afe8Persist strategy runtime state in shared DB backend📊 Changes
6 files changed (+423 additions, -410 deletions)
View changed files
📝
backend/api/content_planning/api/content_strategy/endpoints/ai_generation_endpoints.py(+126 -381)📝
backend/api/content_planning/api/content_strategy/endpoints/streaming_endpoints.py(+13 -29)➕
backend/models/content_strategy_state_models.py(+57 -0)📝
backend/services/database.py(+1 -0)➕
backend/services/shared_state_backend.py(+148 -0)➕
backend/tests/integration/test_shared_state_backend.py(+78 -0)📄 Description
Motivation
user_idplus task/resource/cache identifiers.Description
SharedStateBackendservice (backend/services/shared_state_backend.py) implementing task lifecycle, latest-strategy refs, and short-lived streaming cache with TTL and cleanup.StrategyGenerationTaskState,LatestGeneratedStrategyState, andStreamingCacheStateinbackend/models/content_strategy_state_models.py(tenant-scoped keys + unique indexes).ai_generation_endpoints.pynow uses authenticatedcurrent_user, writes/reads task status viaSharedStateBackend, persists latest strategy refs, and returns robust 404s for expired/missing tasks.streaming_cacheinstreaming_endpoints.pywith the shared DB cache (SharedStateBackend) for strategic intelligence and keyword research flows, and registers the new models in DB init (backend/services/database.py) so tables are created.Testing
python -m py_compile backend/services/shared_state_backend.py backend/api/content_planning/api/content_strategy/endpoints/ai_generation_endpoints.py backend/api/content_planning/api/content_strategy/endpoints/streaming_endpoints.py backend/models/content_strategy_state_models.py backend/tests/integration/test_shared_state_backend.pysucceeded.cd backend && PYTHONPATH=/workspace/ALwrity/backend pytest -q tests/integration/test_shared_state_backend.pywhich exercises multi-worker semantics (separate SQLAlchemy sessions), TTL expiry and not-found behavior; all tests passed (4 passed).Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.