Skip to content

Release/v1.7.3.2#1142

Closed
ljy65535 wants to merge 194 commits intomainfrom
release/v1.7.3.2
Closed

Release/v1.7.3.2#1142
ljy65535 wants to merge 194 commits intomainfrom
release/v1.7.3.2

Conversation

@ljy65535
Copy link
Contributor

@ljy65535 ljy65535 commented Sep 5, 2025

No description provided.

Bavichi and others added 30 commits August 22, 2025 10:08
jiangpeiling and others added 25 commits September 4, 2025 09:55
…resh

# Conflicts:
#	frontend/app/[locale]/setup/modelSetup/components/model/ModelAddDialog.tsx
Comment on lines +26 to +40
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clone model
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Nexent-AI/model-assets
cd ./model-assets
GIT_TRACE=1 GIT_CURL_VERBOSE=1 GIT_LFS_LOG=debug git lfs pull
rm -rf .git .gitattributes
- name: Build data process image (amd64) and load locally
run: |
docker build --platform linux/amd64 -t nexent/nexent-data-process:dev-amd64 -f make/data_process/Dockerfile .

build-data-process-arm64:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To fix this problem, we need to explicitly add a permissions: block specifying the least privilege required for the workflow jobs. Since both jobs only check out code and build Docker images, they do not require any special permissions—only the ability to read repository contents at most, so contents: read is enough. This block can be added at the workflow (top-level) right after the name: and before concurrency:, which will apply it to all jobs in the workflow. No other changes are required, and it will not affect any functionality of existing jobs.


Suggested changeset 1
.github/workflows/auto-build-data-process-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-data-process-dev.yml b/.github/workflows/auto-build-data-process-dev.yml
--- a/.github/workflows/auto-build-data-process-dev.yml
+++ b/.github/workflows/auto-build-data-process-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Data-Process Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-data-process-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Data-Process Images
permissions:
contents: read

concurrency:
group: docker-build-data-process-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +41 to +53
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clone model
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Nexent-AI/model-assets
cd ./model-assets
GIT_TRACE=1 GIT_CURL_VERBOSE=1 GIT_LFS_LOG=debug git lfs pull
rm -rf .git .gitattributes
- name: Build data process image (arm64) and load locally
run: |
docker build --platform linux/arm64 -t nexent/nexent-data-process:dev-arm64 -f make/data_process/Dockerfile . No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To address this issue, we should explicitly set the minimum required permissions for the workflow. This can be done by adding a permissions block at the top level of the workflow YAML, before the jobs: key. The least privilege required for the steps shown (checking out code, cloning models, building Docker images) is read-only access to the repository contents. Therefore, set:

permissions:
  contents: read

No other permissions (write, etc.) are required here, so do not add them. Place the permissions: block after the name: and before concurrency: for clarity and conventional ordering.


Suggested changeset 1
.github/workflows/auto-build-data-process-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-data-process-dev.yml b/.github/workflows/auto-build-data-process-dev.yml
--- a/.github/workflows/auto-build-data-process-dev.yml
+++ b/.github/workflows/auto-build-data-process-dev.yml
@@ -1,5 +1,8 @@
 name: Docker Build Data-Process Images
 
+permissions:
+  contents: read
+
 concurrency:
   group: docker-build-data-process-dev-${{ github.ref }}
   cancel-in-progress: true
EOF
@@ -1,5 +1,8 @@
name: Docker Build Data-Process Images

permissions:
contents: read

concurrency:
group: docker-build-data-process-dev-${{ github.ref }}
cancel-in-progress: true
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +26 to +34
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build main image (amd64) and load locally
run: |
docker build --platform linux/amd64 -t nexent/nexent:dev-amd64 -f make/main/Dockerfile .

build-main-arm64:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To fix this issue, you should add a permissions block to restrict GITHUB_TOKEN permissions. The best way is to add it at the workflow root level (near the top, after name: and before concurrency: or on:), so it applies to all jobs by default. For this Docker build workflow, only minimal permissions are needed for checking out code and building images; contents: read is enough. No additional methods, imports, or definitions are required—simply add the permissions configuration.

Suggested changeset 1
.github/workflows/auto-build-main-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-main-dev.yml b/.github/workflows/auto-build-main-dev.yml
--- a/.github/workflows/auto-build-main-dev.yml
+++ b/.github/workflows/auto-build-main-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Main Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-main-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Main Images
permissions:
contents: read

concurrency:
group: docker-build-main-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +35 to +41
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build main image (arm64) and load locally
run: |
docker build --platform linux/arm64 -t nexent/nexent:dev-arm64 -f make/main/Dockerfile . No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To fix this problem, you should add an explicit permissions block to the workflow to restrict the default GITHUB_TOKEN permissions granted to all jobs. Since the jobs in this workflow only check out code and build Docker images—and do not modify repository contents, create issues, or interact with pull requests—you should set contents: read as the minimum required permission. This change can be made at the workflow level (top of the file, after name), which will apply to all jobs unless overridden. No changes to the jobs or steps are necessary.


Suggested changeset 1
.github/workflows/auto-build-main-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-main-dev.yml b/.github/workflows/auto-build-main-dev.yml
--- a/.github/workflows/auto-build-main-dev.yml
+++ b/.github/workflows/auto-build-main-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Main Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-main-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Main Images
permissions:
contents: read

concurrency:
group: docker-build-main-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +22 to +30
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build terminal image (amd64) and load locally
run: |
docker build --platform linux/amd64 -t nexent/nexent-ubuntu-terminal:dev-amd64 -f make/terminal/Dockerfile .

build-terminal-arm64:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To resolve the flagged issue, add a permissions block at the root level of the workflow YAML (ideally just below the workflow name and before concurrency). This block should restrict the GITHUB_TOKEN to only the necessary privilege. For this workflow, the minimal safe permission is to allow read-only access to repository contents (contents: read). No job in this workflow (based on the code provided) requires additional write permission.
Edit .github/workflows/auto-build-terminal-dev.yml by inserting the following block immediately after line 1:

permissions:
  contents: read

No additional imports or dependencies are required.


Suggested changeset 1
.github/workflows/auto-build-terminal-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-terminal-dev.yml b/.github/workflows/auto-build-terminal-dev.yml
--- a/.github/workflows/auto-build-terminal-dev.yml
+++ b/.github/workflows/auto-build-terminal-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Terminal Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-terminal-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Terminal Images
permissions:
contents: read

concurrency:
group: docker-build-terminal-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +31 to +37
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build terminal image (arm64) and load locally
run: |
docker build --platform linux/arm64 -t nexent/nexent-ubuntu-terminal:dev-arm64 -f make/terminal/Dockerfile . No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To fix the problem, you should add a permissions block at the workflow root level in the .github/workflows/auto-build-terminal-dev.yml file, immediately after the name: key and before any jobs or other blocks. Since all jobs shown only require code checkout and do local docker builds, the minimal permission required is contents: read. This ensures the GITHUB_TOKEN only has read access to repository contents for all jobs in this workflow, following the principle of least privilege. No other permissions appear necessary per the current workflow steps.

Suggested changeset 1
.github/workflows/auto-build-terminal-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-terminal-dev.yml b/.github/workflows/auto-build-terminal-dev.yml
--- a/.github/workflows/auto-build-terminal-dev.yml
+++ b/.github/workflows/auto-build-terminal-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Terminal Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-terminal-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Terminal Images
permissions:
contents: read

concurrency:
group: docker-build-terminal-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +24 to +32
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build web image (amd64) and load locally
run: |
docker build --platform linux/amd64 -t nexent/nexent-web:dev-amd64 -f make/web/Dockerfile .

build-web-arm64:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To fix this issue, we must add a permissions block at the workflow root (above the jobs: key), as no individual jobs have special permissions needs. This block should specifically set contents: read as the minimal starting point, which allows code checkout but blocks write access. If future workflow changes require more permissions (e.g., writing to issues or PRs), these can be added in a fine-grained manner. The change consists of inserting the following block into .github/workflows/auto-build-web-dev.yml, right after the workflow name (recommended) but, in any case, before the jobs: block.

Suggested changeset 1
.github/workflows/auto-build-web-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-web-dev.yml b/.github/workflows/auto-build-web-dev.yml
--- a/.github/workflows/auto-build-web-dev.yml
+++ b/.github/workflows/auto-build-web-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Web Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-web-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Web Images
permissions:
contents: read

concurrency:
group: docker-build-web-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +33 to +39
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build web image (arm64) and load locally
run: |
docker build --platform linux/arm64 -t nexent/nexent-web:dev-arm64 -f make/web/Dockerfile . No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To address this issue, you should add a permissions block to the workflow, ideally at the root level so it applies to all jobs unless overridden. According to least privilege principles for the given workflow, set contents: read. This is a sufficient minimal baseline for typical operations like checking out code. This change should be made at the top level of the file, after the name: and before concurrency: or on:, to ensure the permissions setting is inherited by both jobs. No additional code, methods, or imports are needed since this is a configuration change within the YAML file.

Suggested changeset 1
.github/workflows/auto-build-web-dev.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-build-web-dev.yml b/.github/workflows/auto-build-web-dev.yml
--- a/.github/workflows/auto-build-web-dev.yml
+++ b/.github/workflows/auto-build-web-dev.yml
@@ -1,4 +1,6 @@
 name: Docker Build Web Images
+permissions:
+  contents: read
 
 concurrency:
   group: docker-build-web-dev-${{ github.ref }}
EOF
@@ -1,4 +1,6 @@
name: Docker Build Web Images
permissions:
contents: read

concurrency:
group: docker-build-web-dev-${{ github.ref }}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +22 to +162
runs-on: ${{ github.event_name == 'workflow_dispatch' && fromJson(inputs.runner_label_json) || fromJson('["ubuntu-latest"]') }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate random pull count
id: random-count
run: |
# Generate a random number between 2-5
RANDOM_COUNT=$(shuf -i 2-5 -n 1)
echo "pull-count=$RANDOM_COUNT" >> "$GITHUB_OUTPUT"
echo "Will pull each image $RANDOM_COUNT times"

- name: Clean existing images
run: |
echo "Cleaning existing images..."
docker rmi -f ${{ env.NEXENT_IMAGE }} 2>/dev/null || echo "Image ${{ env.NEXENT_IMAGE }} not found locally"
docker rmi -f ${{ env.NEXENT_WEB_IMAGE }} 2>/dev/null || echo "Image ${{ env.NEXENT_WEB_IMAGE }} not found locally"
docker rmi -f ${{ env.NEXENT_DATA_PROCESS_IMAGE }} 2>/dev/null || echo "Image ${{ env.NEXENT_DATA_PROCESS_IMAGE }} not found locally"
docker rmi -f ${{ env.OPENSSH_SERVER_IMAGE }} 2>/dev/null || echo "Image ${{ env.OPENSSH_SERVER_IMAGE }} not found locally"

# Clean up dangling images
docker image prune -f 2>/dev/null || echo "No dangling images to remove"

echo "Image cleanup completed"

- name: Test pull nexent/nexent:latest
run: |
echo "Testing nexent/nexent:latest image pull..."
PULL_COUNT=${{ steps.random-count.outputs.pull-count }}

for i in $(seq 1 $PULL_COUNT); do
echo "Pull attempt $i/$PULL_COUNT for nexent/nexent:latest"
if docker pull ${{ env.NEXENT_IMAGE }}; then
echo "✅ Successfully pulled nexent/nexent:latest (attempt $i)"
# Remove image after successful pull to prepare for next pull
docker rmi -f ${{ env.NEXENT_IMAGE }} 2>/dev/null || true
else
echo "❌ Failed to pull nexent/nexent:latest (attempt $i)"
exit 1
fi

# Wait 5 seconds if not the last pull attempt
if [ $i -lt $PULL_COUNT ]; then
sleep 5
fi
done

- name: Test pull nexent/nexent-web:latest
run: |
echo "Testing nexent/nexent-web:latest image pull..."
PULL_COUNT=${{ steps.random-count.outputs.pull-count }}

for i in $(seq 1 $PULL_COUNT); do
echo "Pull attempt $i/$PULL_COUNT for nexent/nexent-web:latest"
if docker pull ${{ env.NEXENT_WEB_IMAGE }}; then
echo "✅ Successfully pulled nexent/nexent-web:latest (attempt $i)"
# Remove image after successful pull to prepare for next pull
docker rmi -f ${{ env.NEXENT_WEB_IMAGE }} 2>/dev/null || true
else
echo "❌ Failed to pull nexent/nexent-web:latest (attempt $i)"
exit 1
fi

# Wait 5 seconds if not the last pull attempt
if [ $i -lt $PULL_COUNT ]; then
sleep 5
fi
done

- name: Test pull nexent/nexent-data-process:latest
run: |
echo "Testing nexent/nexent-data-process:latest image pull..."
PULL_COUNT=${{ steps.random-count.outputs.pull-count }}

for i in $(seq 1 $PULL_COUNT); do
echo "Pull attempt $i/$PULL_COUNT for nexent/nexent-data-process:latest"
if docker pull ${{ env.NEXENT_DATA_PROCESS_IMAGE }}; then
echo "✅ Successfully pulled nexent/nexent-data-process:latest (attempt $i)"
# Remove image after successful pull to prepare for next pull
docker rmi -f ${{ env.NEXENT_DATA_PROCESS_IMAGE }} 2>/dev/null || true
else
echo "❌ Failed to pull nexent/nexent-data-process:latest (attempt $i)"
exit 1
fi

# Wait 5 seconds if not the last pull attempt
if [ $i -lt $PULL_COUNT ]; then
sleep 5
fi
done

- name: Test pull nexent/nexent-ubuntu-terminal:latest
run: |
echo "Testing nexent/nexent-ubuntu-terminal:latest image pull..."
PULL_COUNT=${{ steps.random-count.outputs.pull-count }}

for i in $(seq 1 $PULL_COUNT); do
echo "Pull attempt $i/$PULL_COUNT for nexent/nexent-ubuntu-terminal:latest"
if docker pull ${{ env.OPENSSH_SERVER_IMAGE }}; then
echo "✅ Successfully pulled nexent/nexent-ubuntu-terminal:latest (attempt $i)"
# Remove image after successful pull to prepare for next pull
docker rmi -f ${{ env.OPENSSH_SERVER_IMAGE }} 2>/dev/null || true
else
echo "❌ Failed to pull nexent/nexent-ubuntu-terminal:latest (attempt $i)"
exit 1
fi

# Wait 5 seconds if not the last pull attempt
if [ $i -lt $PULL_COUNT ]; then
sleep 5
fi
done

- name: Final cleanup
if: always()
run: |
echo "Performing final cleanup..."
docker rmi -f ${{ env.NEXENT_IMAGE }} 2>/dev/null || echo "Image ${{ env.NEXENT_IMAGE }} already removed"
docker rmi -f ${{ env.NEXENT_WEB_IMAGE }} 2>/dev/null || echo "Image ${{ env.NEXENT_WEB_IMAGE }} already removed"
docker rmi -f ${{ env.NEXENT_DATA_PROCESS_IMAGE }} 2>/dev/null || echo "Image ${{ env.NEXENT_DATA_PROCESS_IMAGE }} already removed"
docker rmi -f ${{ env.OPENSSH_SERVER_IMAGE }} 2>/dev/null || echo "Image ${{ env.OPENSSH_SERVER_IMAGE }} already removed"

# Clean up dangling and unused images
docker image prune -f 2>/dev/null || echo "No images to prune"

echo "Final cleanup completed"

- name: Test Summary
if: always()
run: |
echo "🎯 Docker Image Pull Test Summary"
echo "================================="
echo "Test run completed with ${{ steps.random-count.outputs.pull-count }} pull attempts per image"
echo "Images tested:"
echo " - nexent/nexent:latest"
echo " - nexent/nexent-web:latest"
echo " - nexent/nexent-data-process:latest"
echo " - nexent/nexent-ubuntu-terminal:latest"
echo "Next scheduled run: in 30 minutes"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To fix the problem, the workflow YAML needs an explicit permissions: block that sets the minimum required privileges for the workflow to run. In this case, since the workflow only checks out code and interacts with Docker, and does not require write-access to repository contents or other resources, the safest default is contents: read. This should be added near the top of the workflow file, immediately after the workflow name and before the on: block (or at the job level if specific jobs need different permissions, but in this case a workflow-level permission suffices and is cleanest).

How to fix:

  • Add the following block to the workflow file, directly beneath name: Docker Image Pull Test:
    permissions:
      contents: read
  • This restricts the GITHUB_TOKEN used during the workflow to only be able to read repository contents.

No further changes, imports, or definitions are needed.

Suggested changeset 1
.github/workflows/auto-image-pull-test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/auto-image-pull-test.yml b/.github/workflows/auto-image-pull-test.yml
--- a/.github/workflows/auto-image-pull-test.yml
+++ b/.github/workflows/auto-image-pull-test.yml
@@ -1,4 +1,6 @@
 name: Docker Image Pull Test
+permissions:
+  contents: read
 
 on:
   schedule:
EOF
@@ -1,4 +1,6 @@
name: Docker Image Pull Test
permissions:
contents: read

on:
schedule:
Copilot is powered by AI and may make mistakes. Always verify output.
except Exception as e:
logger.warning(f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: {model_api_key}; Error: {str(e)}")
logger.warning(
f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: {model_api_key}; Error: {str(e)}")

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (password)
as clear text.

Copilot Autofix

AI 6 months ago

To fix the issue, we should avoid logging sensitive information such as API keys. The log message on line 295 (and line 269, which is similar and should also be addressed for completeness) currently includes the raw API key in its message. The best practice is to either remove the API key from the log entirely or, if necessary for debugging, log only a non-sensitive identifier (such as the last 4 characters, or its length—though even this should be avoided if possible).

Specifically, in backend/services/model_health_service.py:

  • Edit the log message in the logger.warning call on line 295 (and line 269) to exclude the API key or replace it with a redacted version (e.g., ***REDACTED*** or ***).
  • No new imports or method definitions are needed; just a change to the log message formatting.

Suggested changeset 1
backend/services/model_health_service.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/services/model_health_service.py b/backend/services/model_health_service.py
--- a/backend/services/model_health_service.py
+++ b/backend/services/model_health_service.py
@@ -266,7 +266,7 @@
         )
     except Exception as e:
         error_message = str(e)
-        logger.warning(f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: {model_api_key}; Error: {error_message}")
+        logger.warning(f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: ***REDACTED***; Error: {error_message}")
         return ModelResponse(
             code=500,
             message="",
@@ -292,5 +292,5 @@
         return dimension
     except Exception as e:
         logger.warning(
-            f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: {model_api_key}; Error: {str(e)}")
+            f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: ***REDACTED***; Error: {str(e)}")
         return 0
EOF
@@ -266,7 +266,7 @@
)
except Exception as e:
error_message = str(e)
logger.warning(f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: {model_api_key}; Error: {error_message}")
logger.warning(f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: ***REDACTED***; Error: {error_message}")
return ModelResponse(
code=500,
message="",
@@ -292,5 +292,5 @@
return dimension
except Exception as e:
logger.warning(
f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: {model_api_key}; Error: {str(e)}")
f"UNCONNECTED: {model_name}; Base URL: {model_base_url}; API Key: ***REDACTED***; Error: {str(e)}")
return 0
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@ljy65535 ljy65535 closed this Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants