{
  "productVersion": "0.11.4",
  "officialWheelSha256": "e4c2b02607ae984ec8ec08f3f9e02a8de06b1226af0f2df37fe2fab7f9d52523",
  "sourceSelection": "Pinned native Note re-read/full content, middleware context application, and three background-task gates. No application source was modified.",
  "fragments": [
    {
      "label": "native-note-read-and-full-content",
      "installedSourceRelativePath": "retrieval/utils.py",
      "installedSourceSha256": "db4d69af71ba9e75d27b0117c3e5a86fc4cdd5c309080b5893b40d355bc80ce1",
      "lineStart": 1439,
      "lineEnd": 1473,
      "excerptPath": "native-note-read-and-full-content.py.txt",
      "excerptSha256": "db3db3688d9d2aacca3556f1ffff29c5f07bbb96ce883743041ad793ad7c9027",
      "excerptUtf8": "                    }\n\n        elif item.get('type') == 'note':\n            # Note Attached\n            note = await Notes.get_note_by_id(item.get('id'))\n\n            if note and (\n                user.role == 'admin'\n                or note.user_id == user.id\n                or await AccessGrants.has_access(\n                    user_id=user.id,\n                    resource_type='note',\n                    resource_id=note.id,\n                    permission='read',\n                )\n            ):\n                # User has access to the note\n                query_result = {\n                    'documents': [[note.data.get('content', {}).get('md', '')]],\n                    'metadatas': [[{'file_id': note.id, 'name': note.title}]],\n                }\n\n        elif item.get('type') == 'chat':\n            # Chat Attached\n            chat = await Chats.get_chat_by_id(item.get('id'))\n            has_read_access = bool(chat and (user.role == 'admin' or chat.user_id == user.id))\n\n            if chat and not has_read_access:\n                has_read_access = await AccessGrants.has_access(\n                    user_id=user.id,\n                    resource_type='shared_chat',\n                    resource_id=chat.id,\n                    permission='read',\n                )\n\n"
    },
    {
      "label": "native-context-application",
      "installedSourceRelativePath": "utils/middleware.py",
      "installedSourceSha256": "bda81a45b4169ec2af351c3eed7a574b0e43cf1026c3d6945dada7290a5af497",
      "lineStart": 3191,
      "lineEnd": 3237,
      "excerptPath": "native-context-application.py.txt",
      "excerptSha256": "abc0d5b239acbf81eb5967f289a8646e3991f45fd28a7447b6e91589746c0aec",
      "excerptUtf8": "                form_data['tools'] = [\n                    {'type': 'function', 'function': tool.get('spec', {})} for tool in tools_dict.values()\n                ]\n                if inlet_filter_tools:\n                    form_data['tools'].extend(inlet_filter_tools)\n            else:\n                # If the function calling is not native, then call the tools function calling handler\n                try:\n                    form_data, flags = await chat_completion_tools_handler(\n                        request, form_data, extra_params, user, models, tools_dict\n                    )\n                    sources.extend(flags.get('sources', []))\n                except Exception as e:\n                    log.exception(e)\n\n    # Check if file context extraction is enabled for this model (default True)\n    file_context_enabled = (model.get('info', {}).get('meta', {}).get('capabilities') or {}).get('file_context', True)\n\n    if file_context_enabled:\n        try:\n            form_data, flags = await chat_completion_files_handler(request, form_data, extra_params, user)\n            sources.extend(flags.get('sources', []))\n        except Exception as e:\n            log.exception(e)\n\n    # Save the pre-RAG message state so the native tool call loop can\n    # restore to the true original (before file-source injection) rather\n    # than a snapshot that already has the RAG template baked in.\n    system_message = get_system_message(form_data['messages'])\n    system_content = get_content_from_message(system_message) if system_message else ''\n    resolved_model_system_prompt = await resolve_system_prompt(\n        model_system_prompt,\n        metadata,\n        user,\n    )\n    if resolved_model_system_prompt:\n        system_content = (\n            f'{resolved_model_system_prompt}\\n{system_content}' if system_content else resolved_model_system_prompt\n        )\n    metadata['system_prompt'] = system_content or None\n    metadata['user_prompt'] = get_last_user_message(form_data['messages'])\n    metadata['sources'] = sources[:] if sources else []\n\n    # If context is not empty, insert it into the messages\n    if sources and prompt:\n        form_data['messages'] = await apply_source_context_to_messages(request, form_data['messages'], sources, prompt)\n\n"
    },
    {
      "label": "native-title-generation-gate",
      "installedSourceRelativePath": "routers/tasks.py",
      "installedSourceSha256": "b9f46202356ddeb382ad93bb1875bdd8b4cd38a454ab3050d616502085cbb0c7",
      "lineStart": 141,
      "lineEnd": 154,
      "excerptPath": "native-title-generation-gate.py.txt",
      "excerptSha256": "34f1498bc571ee913a469ddc4f14cdcd514b9ae6c2ab8f49f56a9af916654e86",
      "excerptUtf8": "@router.post('/title/completions')\nasync def generate_title(request: Request, form_data: dict, user=Depends(get_verified_user)):\n    if not await Config.get('task.title.enable'):\n        return JSONResponse(\n            status_code=status.HTTP_200_OK,\n            content={'detail': 'Title generation is disabled'},\n        )\n\n    if getattr(request.state, 'direct', False) and hasattr(request.state, 'model'):\n        models = {\n            **dict(request.app.state.MODELS.items()),\n            request.state.model['id']: request.state.model,\n        }\n    else:\n"
    },
    {
      "label": "native-followup-generation-gate",
      "installedSourceRelativePath": "routers/tasks.py",
      "installedSourceSha256": "b9f46202356ddeb382ad93bb1875bdd8b4cd38a454ab3050d616502085cbb0c7",
      "lineStart": 214,
      "lineEnd": 227,
      "excerptPath": "native-followup-generation-gate.py.txt",
      "excerptSha256": "781a18d111d98f68ff820e379b35d91fa3ce58af276acf801cbbbbf190becfc6",
      "excerptUtf8": "@router.post('/follow_up/completions')\nasync def generate_follow_ups(request: Request, form_data: dict, user=Depends(get_verified_user)):\n    if not await Config.get('task.follow_up.enable'):\n        return JSONResponse(\n            status_code=status.HTTP_200_OK,\n            content={'detail': 'Follow-up generation is disabled'},\n        )\n\n    if getattr(request.state, 'direct', False) and hasattr(request.state, 'model'):\n        models = {\n            **dict(request.app.state.MODELS.items()),\n            request.state.model['id']: request.state.model,\n        }\n    else:\n"
    },
    {
      "label": "native-tag-generation-gate",
      "installedSourceRelativePath": "routers/tasks.py",
      "installedSourceSha256": "b9f46202356ddeb382ad93bb1875bdd8b4cd38a454ab3050d616502085cbb0c7",
      "lineStart": 279,
      "lineEnd": 291,
      "excerptPath": "native-tag-generation-gate.py.txt",
      "excerptSha256": "5e43cb4966876aff1b56b80c55b0d509d88f6b057ac386276840b5b5fa622c0b",
      "excerptUtf8": "@router.post('/tags/completions')\nasync def generate_chat_tags(request: Request, form_data: dict, user=Depends(get_verified_user)):\n    if not await Config.get('task.tags.enable'):\n        return JSONResponse(\n            status_code=status.HTTP_200_OK,\n            content={'detail': 'Tags generation is disabled'},\n        )\n\n    if getattr(request.state, 'direct', False) and hasattr(request.state, 'model'):\n        models = {\n            **dict(request.app.state.MODELS.items()),\n            request.state.model['id']: request.state.model,\n        }\n"
    }
  ],
  "nativeFullNoteChain": "Actual persisted Notes IDs -> ordinary UI Attach Notes -> native get_sources_from_items re-reads Notes.get_note_by_id and data.content.md -> native source context wrapper -> real provider messages. No direct/manual provider context was constructed.",
  "clientServerDifferences": [
    "Both actual UI POST bodies requested title/tags/follow-up background generation=true. Frozen server environment has all three disabled and persistence disabled; pinned native task routes gate on Config.get before inference. Actual recorder shows exactly two generations total, one per case.",
    "Primary UI params were empty; boundary UI params included tool_approval_mode=full. Both real provider requests still had identical temperature=0/num_ctx=8192/num_predict=1024 and no tools field. The approval UI preference was not a tool execution test."
  ]
}
