Conversation
9c37162 to
d755dea
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors Python Lambda packaging into per-handler assets plus a shared lisa.* Lambda layer, updates CDK to standardize Lambda creation/layer wiring, and adjusts the REST API proxy + React UI to improve runtime behavior and performance.
Changes:
- Reorganize Python Lambda code into
lambda/handlers/<name>/and introducelambda/shared/python/lisa/as a shared LayerVersion, updating imports/tests accordingly. - Add CDK helpers (
definePythonLambda,lambdaCodeAsset,getPythonLambdaLayers/getLisaSharedLayer) and migrate stacks/endpoints to the new pattern. - Update LiteLLM proxy container/runtime request handling and adjust React caching/dynamic imports + smoke-test tooling.
Reviewed changes
Copilot reviewed 233 out of 293 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/lambda/test_vector_store_repo.py | Update imports to lisa.rag.*. |
| test/lambda/test_validators.py | Update imports to lisa.utilities.*. |
| test/lambda/test_validation.py | Update imports to lisa.utilities.*. |
| test/lambda/test_user_preferences_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_update_model_state_machine.py | Update patch/import targets to lisa.* namespaces. |
| test/lambda/test_similarity_functions.py | Update imports/patch targets to lisa.rag.*. |
| test/lambda/test_session_encryption.py | Update imports/patch targets to lisa.utilities.*. |
| test/lambda/test_scheduling_domain_objects.py | Update imports to lisa.domain.*. |
| test/lambda/test_s3_metadata_manager.py | Update imports to lisa.rag.*. |
| test/lambda/test_response_builder.py | Update imports to lisa.utilities.*. |
| test/lambda/test_repository_update_validation.py | Update imports/patch targets to lisa.*. |
| test/lambda/test_repository_state_machine_lambda.py | Update imports to lisa.domain.*. |
| test/lambda/test_prompt_templates_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_projects_lambda.py | Update patch/import targets to lisa.utilities.*. |
| test/lambda/test_numeric_type_preservation.py | Update imports/patch targets to lisa.utilities.*. |
| test/lambda/test_model_context_window_backfill.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_metrics_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_metadata_generator.py | Update imports to lisa.domain/lisa.rag/lisa.utilities. |
| test/lambda/test_mcp_workbench_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_mcp_server_lambda.py | Update imports/patch targets to lisa.*. |
| test/lambda/test_lambda_rds_auth.py | Update imports to lisa.utilities.rds_auth. |
| test/lambda/test_lambda_input_validation.py | Update imports to lisa.utilities.*. |
| test/lambda/test_lambda_decorators.py | Update imports/patch targets to lisa.utilities.*. |
| test/lambda/test_job_status.py | Update imports to lisa.rag.*. |
| test/lambda/test_healthcheck_validator.py | Update imports to lisa.utilities.*. |
| test/lambda/test_header_sanitizer.py | Update imports to lisa.utilities.*. |
| test/lambda/test_event_parser.py | Update imports to lisa.utilities.*. |
| test/lambda/test_encoders.py | Update imports to lisa.utilities.*. |
| test/lambda/test_dockerimagebuilder.py | Update patch targets for new module layout. |
| test/lambda/test_dict_helpers.py | Update imports to lisa.utilities.*. |
| test/lambda/test_delete_model_state_machine.py | Update imports/patch targets to lisa.*. |
| test/lambda/test_create_model_state_machine.py | Update imports/patch targets to lisa.*. |
| test/lambda/test_create_env_variables.py | Update imports to lisa.utilities.create_env_variables. |
| test/lambda/test_constants.py | Update imports to lisa.utilities.constants. |
| test/lambda/test_configuration_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_common_functions.py | Update imports/patch targets to lisa.utilities.*. |
| test/lambda/test_collection_service_extended.py | Update imports to lisa.domain/lisa.rag/lisa.utilities. |
| test/lambda/test_collection_service_cross_repo.py | Update imports to lisa.domain/lisa.rag. |
| test/lambda/test_collection_id_resolution.py | Update imports to lisa.rag.*. |
| test/lambda/test_collection_api_integration.py | Update imports to lisa.domain/lisa.rag. |
| test/lambda/test_chunking_strategy.py | Update imports to lisa.domain/lisa.utilities. |
| test/lambda/test_chat_assistant_stacks_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_bedrock_kb_validation.py | Update imports to lisa.utilities.*. |
| test/lambda/test_bedrock_kb_discovery.py | Update imports to lisa.utilities.*. |
| test/lambda/test_bedrock_kb_collections.py | Update imports to lisa.domain/lisa.rag/lisa.utilities. |
| test/lambda/test_bedrock_agent_discovery.py | Update imports to lisa.domain/lisa.utilities. |
| test/lambda/test_aws_helpers.py | Update imports/patch targets to lisa.utilities.aws_helpers. |
| test/lambda/test_aws_api_gateway_middleware.py | Update imports to lisa.utilities.fastapi_middleware.*. |
| test/lambda/test_authorizer_lambda.py | Update patch targets to lisa.utilities.*. |
| test/lambda/test_audit_logging_utils.py | Update imports to lisa.utilities.*. |
| test/lambda/repository/test_ingestion_type.py | Update imports to lisa.domain.*. |
| test/lambda/repository/test_document_discovery.py | Update imports to lisa.domain/lisa.utilities. |
| test/lambda/repository/state_machine/test_wait_for_collection_deletions.py | Update imports to lisa.domain/lisa.rag. |
| test/lambda/repository/services/test_repository_service_factory.py | Update imports to lisa.rag.services and lisa.utilities. |
| test/lambda/repository/services/test_repository_service.py | Update imports to lisa.domain/lisa.rag.services. |
| test/lambda/repository/services/test_pgvector_repository_service.py | Update imports/patch targets to lisa.rag.services.*. |
| test/lambda/repository/services/test_opensearch_repository_service.py | Update imports/patch targets to lisa.rag.services.*. |
| test/lambda/repository/services/test_bedrock_kb_repository_service.py | Update imports/patch targets to lisa.domain/lisa.rag/lisa.utilities. |
| test/lambda/conftest.py | Update global auth patching to lisa.utilities.* and adjust skip list. |
| pytest.ini | Update pythonpath for new Lambda layout. |
| pyproject.toml | Update pytest pythonpath for new Lambda layout. |
| lib/util/paths.ts | Add handler/shared Lambda path constants. |
| lib/util/lambdaLayers.ts | Add helpers to import layers from SSM and cache lisa-shared. |
| lib/util/lambdaCode.ts | Add handler-directory asset mapping and prebuilt-zip support. |
| lib/util/index.ts | Re-export new util helpers. |
| lib/user-interface/react/vitest.config.ts | Switch Vite React plugin. |
| lib/user-interface/react/src/shared/reducers/user-preferences.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/session.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/rag.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/prompt-templates.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/model-management.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/mcp-tools.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/mcp-server.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/configuration.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/chat-assistant-stacks.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/reducers/api-token.reducer.ts | Adjust RTK Query refetch/cache settings. |
| lib/user-interface/react/src/shared/constants/mcpWorkbenchServerId.ts | Update shared MCP workbench ID source path reference. |
| lib/user-interface/react/src/components/system-banner/system-banner.tsx | Remove aggressive per-mount refetch override. |
| lib/user-interface/react/src/components/chatbot/components/SyntaxHighlightedCode.tsx | Add isolated syntax highlighting module for chunking. |
| lib/user-interface/react/src/components/chatbot/components/Sessions.tsx | Lazy-load JSZip and use default query settings. |
| lib/user-interface/react/src/components/chatbot/components/FileUploadModals.tsx | Lazy-load pdfjs + worker to reduce initial bundle cost. |
| lib/user-interface/react/src/components/chatbot/Chat.tsx | Reduce eager refetching and rely on shared API defaults. |
| lib/user-interface/react/package.json | Add Playwright smoke scripts; swap Vite React plugin deps. |
| lib/serve/rest-api/src/utils/request_utils.py | Add model-specific request parameter stripping helper. |
| lib/serve/rest-api/src/requirements.txt | Update/pin LiteLLM proxy + broaden boto3 bound; adjust click. |
| lib/serve/rest-api/src/main.py | Reorder middleware so CORS is outermost. |
| lib/serve/rest-api/src/api/endpoints/v2/litellm_passthrough.py | Invoke unsupported-param stripping prior to proxying. |
| lib/serve/rest-api/Dockerfile | Add Prisma client generation step for LiteLLM proxy. |
| lib/rag/vector-store/vector-store-creator.ts | Migrate Lambdas to definePythonLambda and handler assets. |
| lib/rag/vector-store/state_machine/delete-store.ts | Migrate state-machine Lambdas to definePythonLambda. |
| lib/rag/api/repository.ts | Update registerAPIEndpoint call signature to pass config. |
| lib/models/litellm-sync.ts | Migrate to definePythonLambda. |
| lib/models/docker-image-builder.ts | Migrate to definePythonLambda. |
| lib/core/coreConstruct.ts | Build/publish LisaSharedLayer and store ARN in SSM. |
| lib/core/apiBaseConstruct.ts | Migrate rotation/IAM-auth Lambdas to definePythonLambda. |
| lib/chat/api/user-preferences.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/chat/api/session.ts | Use getPythonLambdaLayers + adjust projects-table IAM action. |
| lib/chat/api/prompt-template-api.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/chat/api/projects.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/chat/api/mcp.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/chat/api/configuration.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/chat/api/chat-assistant-stacks-api.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/api-tokens/api-tokens.ts | Use getPythonLambdaLayers and updated endpoint registration. |
| lib/api-base/utils.ts | Update registerAPIEndpoint to use handler assets + shared layer. |
| lib/api-base/authorizer.ts | Migrate authorizer Lambda to definePythonLambda. |
| lambda/shared/python/lisa/utilities/time.py | Add shared time helpers. |
| lambda/shared/python/lisa/utilities/repository_types.py | Add shared repository type enum/utilities. |
| lambda/shared/python/lisa/utilities/rds_auth.py | Add shared RDS IAM token helper. |
| lambda/shared/python/lisa/utilities/lambda_decorators.py | Update imports/typing for new lisa.utilities.* layout. |
| lambda/shared/python/lisa/utilities/input_validation.py | Update imports/typing for new lisa.utilities.* layout. |
| lambda/shared/python/lisa/utilities/file_processing.py | Update imports + tighten typing/robustness in text extraction. |
| lambda/shared/python/lisa/utilities/fastapi_middleware/security_headers_middleware.py | Add security headers middleware. |
| lambda/shared/python/lisa/utilities/fastapi_middleware/request_logging_middleware.py | Update imports for new lisa.utilities.* layout. |
| lambda/shared/python/lisa/utilities/fastapi_middleware/exception_handlers.py | Add generic FastAPI exception handler. |
| lambda/shared/python/lisa/utilities/fastapi_middleware/aws_api_gateway_middleware.py | Add APIGW root_path adjustment middleware. |
| lambda/shared/python/lisa/utilities/fastapi_middleware/auth_decorators.py | Update imports for new lisa.utilities.* layout. |
| lambda/shared/python/lisa/utilities/fastapi_middleware/init.py | Export FastAPI middleware/decorators from shared layer. |
| lambda/shared/python/lisa/utilities/fastapi_factory.py | Update FastAPI factory imports to lisa.utilities.*. |
| lambda/shared/python/lisa/utilities/exceptions.py | Add shared exception types. |
| lambda/shared/python/lisa/utilities/event_parser.py | Update imports to lisa.utilities.*. |
| lambda/shared/python/lisa/utilities/encoders.py | Add shared encoder helpers. |
| lambda/shared/python/lisa/utilities/create_env_variables.py | Add shared environment bootstrap module. |
| lambda/shared/python/lisa/utilities/constants.py | Add shared constants. |
| lambda/shared/python/lisa/utilities/common_functions.py | Re-export common helpers via lisa.utilities.*. |
| lambda/shared/python/lisa/utilities/chunking_strategy_factory.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/utilities/bedrock_kb_validation.py | Update imports to lisa.utilities.*. |
| lambda/shared/python/lisa/utilities/bedrock_kb_discovery.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/utilities/bedrock_kb.py | Update imports and improve serialization/casting. |
| lambda/shared/python/lisa/utilities/bedrock_agent_discovery.py | Update imports and normalize returned IDs. |
| lambda/shared/python/lisa/utilities/auth.py | Update exception import to lisa.utilities.exceptions. |
| lambda/shared/python/lisa/utilities/init.py | Add package marker for shared utilities. |
| lambda/shared/python/lisa/session/repository.py | Add projection support for session listing. |
| lambda/shared/python/lisa/session/models.py | Update imports to lisa.utilities.*. |
| lambda/shared/python/lisa/session/init.py | Add package marker for session module. |
| lambda/shared/python/lisa/rag/vector_store_repo.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/rag/services/vector_store_repository_service.py | Update imports to lisa.* namespaces. |
| lambda/shared/python/lisa/rag/services/repository_service_factory.py | Update imports to lisa.utilities.repository_types. |
| lambda/shared/python/lisa/rag/services/repository_service.py | Update imports to lisa.domain.*. |
| lambda/shared/python/lisa/rag/services/pgvector_repository_service.py | Update imports to lisa.* namespaces. |
| lambda/shared/python/lisa/rag/services/opensearch_repository_service.py | Update imports to lisa.* namespaces. |
| lambda/shared/python/lisa/rag/services/bedrock_kb_repository_service.py | Update imports to lisa.* namespaces. |
| lambda/shared/python/lisa/rag/services/init.py | Add package exports for RAG services. |
| lambda/shared/python/lisa/rag/rag_document_repo.py | Update imports to lisa.domain/lisa.rag. |
| lambda/shared/python/lisa/rag/pipeline_ingestion.py | Update imports to lisa.domain/lisa.rag. |
| lambda/shared/python/lisa/rag/metadata_generator.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/rag/job_status.py | Update imports to lisa.domain.*. |
| lambda/shared/python/lisa/rag/ingestion_service.py | Update imports to lisa.domain/lisa.rag. |
| lambda/shared/python/lisa/rag/ingestion_job_repo.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/rag/embeddings.py | Update imports to lisa.utilities.*. |
| lambda/shared/python/lisa/rag/config/params.py | Update imports and harden query param parsing. |
| lambda/shared/python/lisa/rag/config/init.py | Add package marker for RAG config. |
| lambda/shared/python/lisa/rag/collection_repo.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/rag/init.py | Add package marker for RAG module. |
| lambda/shared/python/lisa/metrics/models.py | Add shared metrics event model. |
| lambda/shared/python/lisa/metrics/init.py | Add package marker for metrics module. |
| lambda/shared/python/lisa/mcp/workbench.py | Add shared MCP workbench UUID loader. |
| lambda/shared/python/lisa/mcp/models.py | Update imports to lisa.utilities.*. |
| lambda/shared/python/lisa/mcp/mcp_workbench_server_id.json | Add shared MCP workbench server ID JSON. |
| lambda/shared/python/lisa/mcp/init.py | Add package marker for MCP module. |
| lambda/shared/python/lisa/domain/scheduling/schedule_monitoring.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/domain/scheduling/schedule_management.py | Update imports to lisa.domain/lisa.utilities. |
| lambda/shared/python/lisa/domain/scheduling/init.py | Add package marker for scheduling module. |
| lambda/shared/python/lisa/domain/handler/utils.py | Update imports to lisa.utilities.*. |
| lambda/shared/python/lisa/domain/handler/update_context_window_handler.py | Update imports to lisa.utilities.time. |
| lambda/shared/python/lisa/domain/handler/schedule_handlers.py | Adjust import to new scheduling module path. |
| lambda/shared/python/lisa/domain/handler/list_models_handler.py | Update imports to lisa.utilities.auth. |
| lambda/shared/python/lisa/domain/handler/get_model_handler.py | Update imports to lisa.utilities.auth. |
| lambda/shared/python/lisa/domain/handler/delete_model_handler.py | Update imports to lisa.domain.exception and lisa.rag.*. |
| lambda/shared/python/lisa/domain/handler/create_model_handler.py | Update imports to lisa.domain.exception and lisa.utilities.time. |
| lambda/shared/python/lisa/domain/handler/base_handler.py | Add shared base handler class. |
| lambda/shared/python/lisa/domain/handler/init.py | Export domain handlers. |
| lambda/shared/python/lisa/domain/exception/init.py | Add shared domain exception definitions. |
| lambda/shared/python/lisa/domain/domain_objects.py | Update imports to lisa.utilities.* and normalize page-size parsing. |
| lambda/shared/python/lisa/domain/clients/init.py | Add package marker for domain clients. |
| lambda/shared/python/lisa/domain/init.py | Add package marker for domain module. |
| lambda/shared/python/lisa/init.py | Add package marker for lisa root. |
| lambda/handlers/user_preferences/models.py | Add handler-local user preferences model. |
| lambda/handlers/user_preferences/lambda_functions.py | Add handler entrypoints with test/zip import fallback. |
| lambda/handlers/user_preferences/init.py | Add package marker for handler. |
| lambda/handlers/session/init.py | Add package marker for handler. |
| lambda/handlers/repository/state_machine/wait_for_collection_deletions.py | Update imports to shared lisa.rag repository. |
| lambda/handlers/repository/state_machine/list_modified_objects.py | Update imports to lisa.utilities.*. |
| lambda/handlers/repository/state_machine/cleanup_repo_docs.py | Update imports to lisa.domain/lisa.rag. |
| lambda/handlers/repository/state_machine/init.py | Add package marker for handler submodule. |
| lambda/handlers/repository/pipeline_ingest_handlers.py | Update imports to lisa.* namespaces. |
| lambda/handlers/repository/init.py | Add package marker for handler. |
| lambda/handlers/prompt_templates/models.py | Update imports to lisa.utilities.time. |
| lambda/handlers/prompt_templates/lambda_functions.py | Add handler entrypoints with test/zip import fallback. |
| lambda/handlers/prompt_templates/init.py | Add package marker for handler. |
| lambda/handlers/projects/lambda_functions.py | Update imports to lisa.* namespaces. |
| lambda/handlers/projects/init.py | Add package marker for handler. |
| lambda/handlers/models/state_machine/update_model.py | Update imports to lisa.* and localize failure_utils. |
| lambda/handlers/models/state_machine/schedule_handlers.py | Update imports to lisa.domain.scheduling + lisa.utilities.time. |
| lambda/handlers/models/state_machine/failure_utils.py | Add shared failure parsing helper. |
| lambda/handlers/models/state_machine/delete_model.py | Update imports to lisa.* and localize failure_utils. |
| lambda/handlers/models/state_machine/create_model.py | Update imports to lisa.* namespaces. |
| lambda/handlers/models/state_machine/init.py | Add package marker for handler submodule. |
| lambda/handlers/models/model_context_window_backfill.py | Update imports to lisa.* namespaces. |
| lambda/handlers/models/model_api_key_cleanup.py | Update imports to lisa.utilities.*. |
| lambda/handlers/models/litellm_model_sync.py | Update imports to lisa.* namespaces. |
| lambda/handlers/models/lambda_functions.py | Update imports to lisa.domain + lisa.utilities FastAPI factory/middleware. |
| lambda/handlers/models/init.py | Add package marker for handler. |
| lambda/handlers/metrics/lambda_functions.py | Update imports to lisa.metrics and lisa.utilities.*. |
| lambda/handlers/metrics/batch_job_metric.py | Add Batch job state-change metrics publisher. |
| lambda/handlers/metrics/init.py | Add package marker for handler. |
| lambda/handlers/mcp_workbench/lambda_functions.py | Update imports to lisa.* and use shared MCP UUID constant. |
| lambda/handlers/mcp_workbench/init.py | Add package marker for handler. |
| lambda/handlers/mcp_server/state_machine/update_mcp_server.py | Update imports to lisa.mcp.models and lisa.utilities.time. |
| lambda/handlers/mcp_server/state_machine/delete_mcp_server.py | Update imports to lisa.mcp.models and lisa.utilities.time. |
| lambda/handlers/mcp_server/state_machine/create_mcp_server.py | Update imports to lisa.mcp.models and lisa.utilities.time. |
| lambda/handlers/mcp_server/state_machine/init.py | Add package marker for handler submodule. |
| lambda/handlers/mcp_server/lambda_functions.py | Update imports to lisa.domain/lisa.mcp/lisa.utilities. |
| lambda/handlers/mcp_server/init.py | Add package marker for handler. |
| lambda/handlers/management_key/handler.py | Update imports to lisa.utilities.*. |
| lambda/handlers/management_key/init.py | Add package marker for handler. |
| lambda/handlers/dockerimagebuilder/init.py | Re-export handler symbol for CDK entrypoints. |
| lambda/handlers/db_setup_iam_auth/init.py | Add package marker for handler. |
| lambda/handlers/configuration/lambda_functions.py | Update imports to lisa.* and remove cross-handler coupling. |
| lambda/handlers/configuration/init.py | Add package marker for handler. |
| lambda/handlers/chat_assistant_stacks/models.py | Update imports to lisa.utilities.time. |
| lambda/handlers/chat_assistant_stacks/lambda_functions.py | Update imports to lisa.* and add test/zip import fallback. |
| lambda/handlers/chat_assistant_stacks/init.py | Add package marker for handler. |
| lambda/handlers/authorizer/lambda_functions.py | Update imports to lisa.utilities.*. |
| lambda/handlers/authorizer/init.py | Add package marker for handler. |
| lambda/handlers/api_tokens/lambda_functions.py | Update imports to lisa.utilities.*. |
| lambda/handlers/api_tokens/handler.py | Update imports to lisa.utilities.*. |
| lambda/handlers/api_tokens/exception.py | Add handler-local token exceptions. |
| lambda/handlers/api_tokens/domain_objects.py | Update imports to lisa.utilities.time. |
| lambda/handlers/api_tokens/init.py | Add package marker for handler. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Prisma` lazily at startup and raises "The Client hasn't been generated yet" | ||
| # if the Python client was never generated. The schema lives inside the | ||
| # litellm_proxy_extras package (e.g. .../site-packages/litellm_proxy_extras/schema.prisma). | ||
| RUN python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('litellm_proxy_extras'); print(pathlib.Path(spec.origin).parent / 'schema.prisma')" > /tmp/litellm_schema_path \ |
There was a problem hiding this comment.
Adding a note that we want to double check this with some different builds in VPC without internet connection.
| # Enable CORS. This MUST be the last middleware registered so it becomes the | ||
| # outermost wrapper and can attach CORS headers to every response, including | ||
| # error responses produced (or short-circuited) by the middleware below. | ||
| app.add_middleware( |
There was a problem hiding this comment.
We will have a conflict with the security PR adding CORS settings.
| // downloaded when the first fenced code block is rendered. | ||
| const SyntaxHighlightedCode = lazy(() => import('../components/SyntaxHighlightedCode')); | ||
|
|
||
| const CodeBlockFallback: React.FC<{ code: string; isDarkMode: boolean }> = ({ code, isDarkMode }) => ( |
There was a problem hiding this comment.
Review: Test markdown rendering with all plugins
f6d728f to
2ff7de8
Compare
2ff7de8 to
8d89c2c
Compare
Summary
This PR restructures how Python Lambdas are packaged and how shared code is imported, then threads that model through CDK. It also tightens session list performance, updates the LiteLLM proxy image and request handling, and adds a post-build browser smoke test for the React app.
Python Lambda layout:
handlers+lisashared layerlambda/handlers/<name>/(per-function zip root). CDK zips each handler directory only (no more monolithiclambda/asset for most functions).lambda/shared/python/lisa/and deployed as a newLisaSharedLayer(Core stack). At runtime it is available asimport lisa.*(e.g.lisa.utilities.*,lisa.domain.*,lisa.rag.*,lisa.mcp.*,lisa.session.*).utilities/models/repository/mcp_servermodules to thelisapackage namespace.lisa.mcp.models; MCP workbench server id is loaded from shared JSON via newlisa.mcp.workbench(single source for Lambdas, config, UI).db_setup_iam_authas its own handler packagemanagement_keyashandler.pyunderhandlers/management_key/dockerimagebuilderpackage exportshandlerfor CDKlambda_functions.<fn>(notpackage.subpkg.lambda_functions) inregisterAPIEndpoint, matching files at the zip root.CDK:
definePythonLambda,lambdaCodeAsset,getPythonLambdaLayerslib/util/:definePythonLambda: standard Python Lambda defaults (runtime, 180s / 512 MiB, VPC wiring) and auto-attachment of LisaSharedLayer (deduped per scope).lambdaCodeAsset/LAMBDA_HANDLERS: maps each API to a single handler directory; supportsconfig.lambdaPath→.zipfor air-gapped / prebuilt bundles.getPythonLambdaLayers: DRYs SSM lookups for third-party layers (common, fastapi, authorizer) with stable construct ids.registerAPIEndpointnow takesconfiginstead of a string path, useslambdaCodeAsset, and prependsgetLisaSharedLayerto the layer list.Function+Code.fromAsset(LAMBDA_PATH)to the new pattern; handler strings are relative to the handler asset (e.g.state_machine.create_mcp_server.…).Core:
LisaSharedLayer+ SSMCoreConstructbuildslambda/shared/python/as a LayerVersion and publishes${deploymentPrefix}/layerVersion/lisa-sharedin SSM for cross-stack use.Session API: performance and IAM
list_sessionsuses a DynamoDB projection that omits large fields (configuration/encrypted_configuration) to shrink payloads for the session list.projectIdswitches from BatchGetItem to per-idget_item, with str() normalization so string and numeric ids match the allowed set; IAM for the session Lambda is updated fromdynamodb:BatchGetItemtodynamodb:GetItemon the projects table.mcp_server.lambda_functions(avoids cross-handler coupling).REST API (LiteLLM) container and proxy
prisma generateagainst LiteLLM’s bundled schema so the Python Prisma client exists at startup (LiteLLM ≥ 1.83.x may import it lazily;db pushalone is insufficient).requirements.txt: LiteLLM[proxy]pinned to 1.83.10 (Anthropic Opus 4.7 / adaptive thinking on Bedrock); boto3 upper bound widened to<2.0.0and click floor adjusted for resolver compatibility with LiteLLM’s pins.main.py: CORS middleware re-registered last so it is outermost and adds CORS headers to all responses (including auth failures and 5xx), with an explanatory comment on Starlette order.litellm_passthrough+request_utils:strip_unsupported_model_paramsremoves parameters known to be rejected by specific models (e.g. Opus 4.7 /top_p) using regex on the canonical model path, with logging when stripping occurs.React UI
vite.config.ts: more aggressive chunking (implied by smoke-test rationale); worth validating no regressions.SyntaxHighlightedCodeand updates tomarkdownRenderer,Chat,FileUploadModals,Sessions, small system-banner tweak.App.tsx: larger routing / bootstrap changes (review for auth, base path, and MCP workbench).vitepressfrom app dependencies; added Playwright for smoke tests.scripts/smoke-test.mjs+ npm scriptstest:smoke/test:smoke:build:** headless load ofvite previewto catch runtime chunk initialization errors after build.Chat Session + MCP Tools Update
toolCalls” as always needing execution, including right after hydrating history from the API (lastProcessedMessageIndexstarted at-1).updateSessionbefore the tool chain ran, right aftergenerateResponsemarked the session dirty.Changes
loadingSessiongoes fromtrue→false, setlastProcessedMessageIndexto the last loaded index so hydrated history is not treated as a new pending tool turn.updateSessionwhen it’s safe: last turn is assistant, not streaming (!isStreaming), andsessionHistoryHasPendingAssistantToolCallsis false (new helper insessionPersist.utils.ts). If we skip because tools are pending, leavedirtySessiontrue so a later save still runs after tools + follow-up reply.SessionConfigurationskips the configuration PUT under the same “pending assistant tool calls” rule so changing options mid–tool-call doesn’t write a bad tail; local config still updates and will be included on the next normal save.sessionPersist.utils.test.tscovers the helper.Tests and tooling
test/lambda: mass update of imports andpatch()targets tolisa.*paths;conftest/pytest.ini/pyproject.tomladjusted for the new package layout and paths.Ops / review notes
LAMBDA_HANDLERSinlib/util/lambdaCode.tsand have a directory underlambda/handlers/.test:smokeruns, or document skipping.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.