Skip to content

feat: add API key overview and codex inspection persistence#67

Open
janfengye wants to merge 1 commit into
seakee:mainfrom
janfengye:feat/api-key-monitoring-and-codex-inspection
Open

feat: add API key overview and codex inspection persistence#67
janfengye wants to merge 1 commit into
seakee:mainfrom
janfengye:feat/api-key-monitoring-and-codex-inspection

Conversation

@janfengye
Copy link
Copy Markdown

Summary

  • keep API Key overview in monitoring and avoid exposing plaintext client API keys in the frontend
  • add Codex inspection persistence foundation with SQLite-backed runs, results and logs
  • add backend-driven Codex inspection APIs and frontend integration for history/reload flows

Validation

  • built frontend with vite
  • built cpa-manager usage-service with go build
  • verified API key map returns masked values only

Notes

  • commit contains only source files
  • no runtime config, API keys, account credentials, or sqlite data files are included

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25b94c7f77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +301 to +304
if err != nil {
_ = m.SaveLog(context.Background(), run.RunID, LogError, err.Error())
run.Status = string(StatusFailed)
now := time.Now().UnixMilli()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep canceled inspections out of failed state

When a user pauses/stops a run, the runner returns ctx.Err() after persisting StatusStopped, but this branch unconditionally rewrites the run as failed. That means intentional cancellations can end up shown as failures in history (and overwrite the earlier stopped/paused snapshot), which is misleading operationally and breaks status-based workflows.

Useful? React with 👍 / 👎.

Comment on lines +239 to +243
client := &http.Client{Timeout: time.Duration(max(1, settings.Timeout)) * time.Millisecond}
res, err := client.Do(req)
if err != nil {
logf(LogWarning, fmt.Sprintf("%s \u63a2\u6d4b\u5f02\u5e38\uff0c\u4fdd\u7559\u8d26\u53f7\uff1a%s", account.DisplayAccount, err.Error()))
return Result{Account: account, Action: ActionKeep, ActionReason: "\u63a2\u6d4b\u5f02\u5e38\uff0c\u4fdd\u7559\u8d26\u53f7", Error: err.Error(), UpdatedAtMS: now}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply retry setting during probe requests

The inspection settings include a retries field, but probe execution performs exactly one api-call attempt and returns immediately on transport/parse errors. In unstable networks, this creates avoidable false negatives (accounts marked as probe-exception/keep) even when operators configured retries to smooth transient failures.

Useful? React with 👍 / 👎.

Comment on lines +155 to +156
func BuildRunID(ts time.Time) string {
return ts.Format("20060102150405")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Generate run IDs with sub-second uniqueness

Run IDs are formatted only to second precision, so multiple starts within the same second produce identical run_id values. Because run persistence uses ON CONFLICT(run_id) DO UPDATE, concurrent/rapid starts can overwrite each other’s metadata and results, effectively corrupting run history.

Useful? React with 👍 / 👎.

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.

1 participant