---
id: T-395
name: "Fix search page htmx swap not rendering results"
description: >
  Fix search page htmx swap not rendering results. The hx-swap target was mismatched
  causing search results to silently fail to appear in the DOM.

status: work-completed
workflow_type: build
owner: human
horizon:
tags: []
components: [agents/handover/handover.sh]
related_tasks: []
created: 2026-03-09T18:12:44Z
last_update: '2026-06-11T22:24:20Z'
date_finished: 2026-03-09T18:37:36Z
bvp_scores_proposed:
  - ts: '2026-06-11T22:24:20Z'
    estimator: bvp-estimator-v1-heuristic
    scores:
      D1: 2
      D2: 0
      D3: 0
      D4: 0
      F-RECALL: 1
      F-ORCH: 0
      F3: 0
      F1: 1
      F2: 0
    rationale: D1=2 (body:concern-ref); D2=0 (no-signal); D3=0 (no-signal); D4=0
      (no-signal); F-RECALL=1 (body:episodic-only); F-ORCH=0 (no-signal); F3=0 
      (no-signal); F1=1 (body/components:context-fabric-incidental); F2=0 
      (no-signal)
    rubric_sha: e4a00f38e801
---

# T-395: Fix search page htmx swap not rendering results

## Context

Search page clicks fired htmx requests but page never updated. Root cause: embeddings.py used global ollama client (localhost) instead of configured host (192.168.10.107), and vector index rebuilt on every search (120s stale threshold). Also fixed handover zero-TODO generator (G-018).

## Acceptance Criteria

### Agent
- [x] Search returns results within 5 seconds for hybrid mode
- [x] Ollama client uses Config.OLLAMA_HOST (not localhost default)
- [x] Vector index reused from disk when available
- [x] Graceful fallback to keyword search when vector index not ready
- [x] Zero-TODO handover generator (G-018 prevention)
- [x] All existing handover files cleaned of TODOs

### Human
- [x] [REVIEW] Search page works in browser
  **Steps:**
  1. Open http://192.168.10.107:3000/search
  2. Type "healing loop" and click Search
  **Expected:** Results appear within 2 seconds, categorized with snippets
  **If not:** Check Flask log at /tmp/flask.log for errors

## Verification

curl -sf --max-time 10 'http://localhost:3000/search?q=healing+loop&mode=hybrid' | grep -q 'results for'
grep -q 'is_index_ready' web/blueprints/discovery.py
grep -q '_get_ollama_client' web/embeddings.py
grep -rL '\[TODO' .context/handovers/S-*.md | wc -l | grep -q '^0$' || test $(grep -rl '\[TODO' .context/handovers/S-*.md 2>/dev/null | wc -l) -eq 0

## Decisions

<!-- Record decisions ONLY when choosing between alternatives.
     Skip for tasks with no meaningful choices.
     Format:
     ### [date] — [topic]
     - **Chose:** [what was decided]
     - **Why:** [rationale]
     - **Rejected:** [alternatives and why not]
-->

## Updates

### 2026-03-09T18:12:44Z — task-created [task-create-agent]
- **Action:** Created task via task-create agent
- **Output:** /opt/999-Agentic-Engineering-Framework/.tasks/active/T-395-fix-search-page-htmx-swap-not-rendering-.md
- **Context:** Initial task creation

### 2026-03-09T18:37:36Z — status-update [task-update-agent]
- **Change:** status: started-work → work-completed

### 2026-03-10T22:04:14Z — status-update [task-update-agent]
- **Change:** horizon: now → next

## Reviewer Verdict (v1.5)

- **Scan ID:** R-8c8885f6
- **Timestamp:** 2026-06-02T15:02:35Z
- **Catalogue:** v1.3-seed
- **Overall:** CONCERN
- **Needs Human:** no
- **Findings:** 2

**Verification-level findings:**

  1. **l387-sigpipe-risk** (partial, heuristic) @ Verification:line 1
     - evidence: `curl -sf --max-time 10 'http://localhost:3000/search?q=healing+loop&mode=hybrid' | grep -q 'results for'`
  2. **l387-sigpipe-risk** (partial, heuristic) @ Verification:line 4
     - evidence: `grep -rL '\[TODO' .context/handovers/S-*.md | wc -l | grep -q '^0$' || test $(grep -rl '\[TODO' .context/handovers/S-*.md 2>/dev/null | wc -l) -eq 0`
