Agent improvements: image passthrough, context fixes, thinking indicator, observability #50
Open
ryan
wants to merge 5 commits from
agent-improvements into main
pull from: agent-improvements
merge into: ryan:main
ryan:main
ryan:docs/efficiency-tickets
ryan:docs/immich-mcp-tickets
ryan:fix/reindex-targets
ryan:docs/immich-mcp-design
ryan:fix/ci-frontend-yarn
ryan:feat/obsidian-write-sync
ryan:perf/prune-checkpoints
ryan:perf/obsidian-sync-off-loop
ryan:perf/full-search-chunks
ryan:perf/concise-answers
ryan:fix/image-ownership
ryan:fix/scheduled-messages-migration
ryan:feat/application-foundation
ryan:feat/config-ci
ryan:perf/stable-prompt-prefix
ryan:perf/fk-indexes
ryan:perf/offload-image-processing
ryan:perf/ynab-sync-interval
ryan:perf/batch-paperless-embeddings
ryan:feat/context-quality
ryan:fix/ynab-outflow-consistency
ryan:feat/ynab-report-totals
ryan:feat/context-management
ryan:fix/stream-stall-timeout
ryan:feat/cowork-file-drop
ryan:feat/cowork-artifact-panel
ryan:feat/cowork-timeline
ryan:feat/prompt-current-date
ryan:feat/cowork-tool-artifacts
ryan:feat/ynab-mirror
ryan:feat/cowork-stream
ryan:plan/cowork-ui
ryan:fix/access-token-auth
ryan:fix/access-token-auth-backend
ryan:explore/desktop-client
ryan:feat/homebox-set-item
ryan:feat/bookstack-mcp
ryan:feat/homebox-mcp
ryan:stream-observability
ryan:agent-image-and-context-fixes
ryan:feature/math-and-split-bill-tools
ryan:imessage-image-upload
ryan:paste-image-upload
ryan:llama-timeouts
ryan:fix-answer-bubble-react-import
ryan:copy-answer-messages
ryan:update-claude-md
ryan:mobile-drawer-conversation-pagination
ryan:conversation-routing
ryan:frontend-interactions-cleanup
ryan:eversweet-ultra-support
ryan:refactor/frontend-hooks
ryan:fix/obsidian-sync-setup
ryan:feat/improve-system-prompt
ryan:refactor/chromadb-to-pgvector
ryan:feat/rename-conversations-command
ryan:fix/mobile-conversation-launch
ryan:feat/conversation-name-truncation
ryan:feat/user-memory
ryan:feat/conversation-ordering-and-naming
ryan:fix/oidc-null-groups
ryan:extend-jwt-expiration
ryan:fix/mobile-input-performance
ryan:feat/makefile-redeploy
ryan:fix/image-in-existing-conversations
ryan:fix/image-presigned-urls
ryan:test/unit-tests
ryan:fix/ynab-transaction-limit
ryan:worktree-crispy-whistling-snowglobe
ryan:feature/llama-cpp-integration
ryan:rc/langchain-migration
ryan:rc/01012025-retitling
ryan:mobile-responsive-layout
ryan:async-reindexing
ryan:update-favicon-and-title
ryan:conversation-uplift
ryan:quart-login
ryan:user-support
ryan:rc/9-metadata-date-filtering
ryan:data-preprocessing
ryan:better-embeddings
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "agent-improvements"
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?
Consolidates the work from this session into a single PR off main.
Changes
Image passthrough — images are now sent directly to the agent as multimodal content instead of running a separate describe-then-answer LLM call. Roughly halves image-turn latency; streaming starts immediately.
Context fixes — two bugs that caused the model to lose track of conversation context:
msg.speaker(aSpeakerenum) was compared to the string"user"— always false — so every prior message was replayed asrole: assistant. The model saw a transcript where it apparently said everything itself. Fixed across web, iMessage, WhatsApp, and email.speaker="tool"messages (capped at 4000 chars) and replayed in history. History window bumped 10 → 20 to accommodate.Thinking indicator — qwen3.8-27b reasons silently for tens of seconds before producing content. The stream now emits a heartbeat every second during the thinking phase; the frontend shows a pulsing "Thinking..." pill so the UI doesn't look hung. The heartbeat also keeps the SSE connection alive through proxy idle-timeouts.
No cancel on nav-away — navigating to a different conversation no longer aborts the in-flight stream. Generation completes in the background, response is persisted, and it's there when you return. The stop button still cancels immediately.
Structured timing logs — every
stream-queryrequest emits a JSON summary on completion:Grep:
journalctl -u raggr-blue | grep stream_request74/74 tests pass.
🤖 Generated with Claude Code
qwen3.8-27b is a reasoning model: it can think for hundreds of tokens before any visible content streams. The SSE stream only forwarded content deltas, so the UI showed dead air for the whole think and long answers looked hung (users cancel ~1 min in). The stream now emits a throttled {"type": "thinking"} heartbeat while the current model turn has produced no content yet, and the frontend renders a pulsing "Thinking..." pill until content or a tool call arrives. The heartbeat also keeps bytes flowing on the SSE connection during long thinks, so idle-timeout disconnects in the proxy chain can't kill the stream. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Every SSE request emits a JSON summary line to the logger on completion, cancellation, or error: {"event":"stream_request","conv":"...","user":"ryan", "total_ms":45210,"thinking_ms":38100,"ttft_ms":38200, "tokens":112,"tools":[{"tool":"web_search","ms":820}], "model":"llama","cancelled":false} Fields: - total_ms end-to-end wall time - thinking_ms time from first LLM call to first content token (reasoning) - ttft_ms time to first content token from request start - tokens approximate content token count (stream deltas) - tools each tool invoked with wall-clock duration - model LLM name from LangChain metadata (catches fallback to OpenAI) - cancelled true when client disconnected mid-stream Tool timers use the LangChain run_id to correctly pair start/end even when the same tool is called multiple times in one turn. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.