Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: Quick Enrich auto-advances past exhausted categories instead of showing error

Adam Eivy3decdc430606
diff --git a/.changelog/v0.11.x.md b/.changelog/v0.11.x.md
index 810ef489ab..0ab75a2476 100644
--- a/.changelog/v0.11.x.md
+++ b/.changelog/v0.11.x.md
@@ -109,6 +109,11 @@ This release focuses on security improvements, bug fixes for the AI runner syste
- **Category exhaustion UI**: EnrichTab now shows a "all questions answered" completion view when a category has no more questions, instead of silently falling back to category selection
- **Deduplicated near-identical questions**: `values` and `non_negotiables` categories previously had nearly identical first questions; `values` now asks a distinct question about top three guiding values
+### Quick Enrich Shows "Unable to Load Question" for Exhausted Categories
+- **Auto-advance to next gap**: When a category's questions are exhausted (all predefined, scale, and fallback answered) and AI generation isn't available, the NextActionBanner now automatically advances to the next gap category instead of showing "Unable to load question"
+- **Graceful exhaustion UI**: If all gap categories are exhausted, the banner shows an "Enrichment questions complete" view with links to run an interview or behavioral tests
+- **Stable gap tracking**: Uses category-based dependency tracking instead of array references to prevent unnecessary resets during parent re-renders
+
### Quick Enrich Skip Returns Same Question
- **Skip now advances to a different question**: Clicking "Skip" on Quick Enrich prompts (both in the overview banner and the full EnrichTab) previously returned the exact same question, because question selection was deterministic based on `questionsAnswered` count which skip didn't increment
- **Client tracks skipped indices**: Both NextActionBanner and EnrichTab now maintain a `skippedIndices` list for the current session, passing it to the server so it can serve the next non-skipped question
diff --git a/client/src/components/digital-twin/NextActionBanner.jsx b/client/src/components/digital-twin/NextActionBanner.jsx
index bf776794cc..3d9f1c9b72 100644
--- a/client/src/components/digital-twin/NextActionBanner.jsx
+++ b/client/src/components/digital-twin/NextActionBanner.jsx
@@ -42,25 +42,47 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
const [submitting, setSubmitting] = useState(false);
const [skippedIndices, setSkippedIndices] = useState([]);
+ const [currentGapIdx, setCurrentGapIdx] = useState(0);
+
const hasTraits = traits && Object.keys(traits).length > 0;
const hasEnrichment = (status?.enrichmentProgress?.completedCategories?.length || 0) > 0;
const hasGaps = gaps && gaps.length > 0;
- const topGap = hasGaps ? gaps[0] : null;
- const topCategory = topGap?.suggestedCategory;
- const isListBased = topCategory && ENRICHMENT_CATEGORIES[topCategory]?.listBased;
+ // Use currentGapIdx to allow advancing past exhausted categories
+ const activeGap = hasGaps ? gaps[currentGapIdx] || null : null;
+ const activeCategory = activeGap?.suggestedCategory;
+ const isListBased = activeCategory && ENRICHMENT_CATEGORIES[activeCategory]?.listBased;
+
+ // Reset gap index when the actual gap categories change (stable dep, not array reference)
+ const gapKey = gaps?.map(g => g.suggestedCategory).join(',') || '';
+ useEffect(() => {
+ setCurrentGapIdx(0);
+ setQuestion(null);
+ }, [gapKey]);
- // Load a question for the top gap's category (only for Q&A categories)
+ // Load a question for the active gap's category (only for Q&A categories)
useEffect(() => {
- if (topCategory && !isListBased) {
+ if (activeCategory && !isListBased) {
setSkippedIndices([]);
- loadQuestion(topCategory);
+ loadQuestion(activeCategory);
}
- }, [topCategory, isListBased]);
+ }, [activeCategory, isListBased]);
const loadQuestion = async (category, skipList = []) => {
setLoading(true);
const q = await api.getSoulEnrichQuestion(category, undefined, undefined, skipList.length ? skipList : undefined).catch(() => null);
+ if (!q) {
+ // Category exhausted — advance to the next gap with available questions
+ setCurrentGapIdx(prev => {
+ for (let i = prev + 1; i < (gaps?.length || 0); i++) {
+ if (gaps[i]?.suggestedCategory) return i;
+ }
+ return prev; // No more gaps, stay put (render will show completion)
+ });
+ setQuestion(null);
+ setLoading(false);
+ return;
+ }
setQuestion(q);
setAnswer('');
setScaleValue(null);
@@ -78,7 +100,7 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
const payload = {
questionId: question.questionId,
- category: topCategory,
+ category: activeCategory,
question: question.question
};
@@ -102,16 +124,16 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
setScaleValue(null);
setSkippedIndices([]);
onRefresh?.();
- await loadQuestion(topCategory);
+ await loadQuestion(activeCategory);
setSubmitting(false);
};
const handleSkip = () => {
- if (!topCategory || !question) return;
+ if (!activeCategory || !question) return;
const idx = question.questionType === 'scale' ? -(question.scaleIndex + 1) : question.questionIndex;
const nextSkipped = idx != null ? [...skippedIndices, idx] : skippedIndices;
setSkippedIndices(nextSkipped);
- loadQuestion(topCategory, nextSkipped);
+ loadQuestion(activeCategory, nextSkipped);
};
const handleKeyDown = (e) => {
@@ -170,12 +192,45 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
}
// Mode 2: Gaps exist - inline question or navigate prompt
- const urgency = getUrgencyBadge(topGap.confidence);
- const dimensionLabel = DIMENSION_LABELS[topGap.dimension] || topGap.dimension;
+ // If all Q&A gaps are exhausted (activeGap is null), show completion
+ if (!activeGap) {
+ return (
+ <div className="bg-green-500/10 border border-green-500/30 rounded-lg p-5">
+ <div className="flex items-start gap-3">
+ <CheckCircle className="w-5 h-5 text-green-400 mt-0.5 flex-shrink-0" />
+ <div className="flex-1">
+ <h3 className="text-white font-medium mb-1">Enrichment questions complete</h3>
+ <p className="text-sm text-gray-400 mb-3">
+ All available enrichment questions have been answered. Run an interview or behavioral tests to strengthen remaining dimensions.
+ </p>
+ <div className="flex items-center gap-2">
+ <button
+ onClick={() => navigate('/digital-twin/interview')}
+ className="px-4 py-2 bg-purple-600 text-white rounded-lg text-sm hover:bg-purple-500 flex items-center gap-2"
+ >
+ Run Interview
+ <ArrowRight size={14} />
+ </button>
+ <button
+ onClick={() => navigate('/digital-twin/test')}
+ className="px-4 py-2 bg-green-600 text-white rounded-lg text-sm hover:bg-green-500 flex items-center gap-2"
+ >
+ Run Tests
+ <ArrowRight size={14} />
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+ }
+
+ const urgency = getUrgencyBadge(activeGap.confidence);
+ const dimensionLabel = DIMENSION_LABELS[activeGap.dimension] || activeGap.dimension;
// List-based category: show navigate prompt instead of inline Q&A
if (isListBased) {
- const catConfig = ENRICHMENT_CATEGORIES[topCategory];
+ const catConfig = ENRICHMENT_CATEGORIES[activeCategory];
return (
<div className="bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border border-yellow-500/30 rounded-lg p-5">
<div className="flex items-start gap-3">
@@ -189,7 +244,7 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
Add your {catConfig?.label?.toLowerCase() || 'items'} to strengthen this dimension.
</p>
<button
- onClick={() => navigate(`/digital-twin/enrich?category=${topCategory}`)}
+ onClick={() => navigate(`/digital-twin/enrich?category=${activeCategory}`)}
className="px-4 py-2 bg-yellow-600 text-white rounded-lg text-sm hover:bg-yellow-500 flex items-center gap-2"
>
Add {catConfig?.label || 'Items'}
@@ -258,7 +313,7 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
</button>
</div>
<button
- onClick={() => navigate(`/digital-twin/enrich?category=${topCategory}`)}
+ onClick={() => navigate(`/digital-twin/enrich?category=${activeCategory}`)}
className="text-xs text-port-accent hover:text-white"
>
Full enrichment →
@@ -269,7 +324,15 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
)}
</>
) : (
- <p className="text-sm text-gray-400">Unable to load question.</p>
+ <p className="text-sm text-gray-400">
+ All questions for this dimension have been answered.{' '}
+ <button
+ onClick={() => navigate('/digital-twin/interview')}
+ className="text-port-accent hover:text-white"
+ >
+ Run an interview
+ </button>{' '}to strengthen it further.
+ </p>
)}
</div>
</div>