Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
abe1157
fix(phase1): F-D4+F-D5+F-D13 HTTP超时 + F-D6 Close错误传播 + F-D18 分页校验 + F…
Apr 27, 2026
44c33ef
fix(phase1): F-D2+F-D3 NoAuth + F-D1 FlushAll + F-D28+F-D29+F-D30 凭证泄…
Apr 27, 2026
df7d900
fix(worker-c2): Redis/cache deepening — F-D21/F-D51/F-D53/F-D54/F-D55
Apr 27, 2026
165c9ff
fix(c5): F-D74(verify)/F-D75/F-D76/F-D77 — HTTP client P2 fixes
Apr 27, 2026
e2393c9
fix(w10): F-D82/83/84/87 — GraphQL/misc P3 fixes
Apr 27, 2026
9431022
fix(c8): F-D71/F-D72/F-D73/F-D94/F-D95/F-D96/F-D97 — migration/misc P…
Apr 27, 2026
35e3371
fix(c4): F-D49/F-D59/F-D68/F-D70 — middleware/migration/aggregation f…
Apr 27, 2026
ac3bb7f
fix(c7): F-D58/F-D61/F-D62/F-D91/F-D92/F-D93 — backup/GC P3 fixes
Apr 27, 2026
df84c9e
fix(w9a): F-D52/60/63/64/65 — security hardening batch 1
Apr 27, 2026
5852a20
fix(c6): F-D88/F-D89/F-D90 — closed atomic + watcher ctx + tracker re…
Apr 27, 2026
3450f69
fix(c3): F-D56/F-D57 — connection tracking + perf race fix
Apr 27, 2026
d6ddde9
fix(w8a): F-D39/40/41/42/43 — Transformer nil/subtraction/overwrite f…
Apr 27, 2026
951f32c
fix(c6): F-D85/F-D86 — Redis panic + provider_quota syntax
Apr 27, 2026
06c895d
fix(w8c): F-D80/81 — Gemini URL dedup + Anthropic Moonshot heuristic
Apr 27, 2026
2e91ddc
fix(w8b): F-D44/78/79 — Anthropic fallback + content-type + URL parsing
Apr 27, 2026
0a3c8cc
fix(r1): F-D2 — AllowNoAuth empty-key passthrough fix
Apr 27, 2026
d9bcd93
fix(r3): F-D19/F-D22 — sliding window + half-open circuit breaker
Apr 27, 2026
f16bced
fix(r5): F-D7/F-D34/F-D72 — GC retry + WaitGroup + soft-delete respect
Apr 27, 2026
f2e210f
fix(r4): F-D25/F-D26/F-D27 — backup failure path + full data + prefix…
Apr 27, 2026
d22f180
fix(r6): F-D8/F-D9/F-D10 — retry ctx + backoff + body limit
Apr 27, 2026
056763f
fix(r9): F-D37/F-D29 — Dumper cleanup logic + wrapHttpError sanitization
Apr 27, 2026
2e452ee
fix(r10): F-D74/50/45/46/47 — builder panic + GraphQL N+1/Nodes/scope
Apr 27, 2026
faadd74
fix(r8): F-D33/F-D35/F-D38 — S3 atomic + DB/GCS ctx propagation
Apr 27, 2026
5897f62
fix(f5): gc_test.go — signature + CleanupStats adaptation
Apr 27, 2026
8daa206
fix(f2): F-D24 — livePreviewMiddleware sync.Once
Apr 27, 2026
5d3e5ed
fix(f8): dataurl_test.go — text/html → text/plain whitelist compat
Apr 27, 2026
63a0f34
fix(f4): data_storage_test.go — signature + *string adaptation
Apr 27, 2026
9a4e0d2
fix(f3): F-D98 — Initialize sync.Once anti-reentry
Apr 27, 2026
0860f68
fix(f6): middleware/migrator/api test — 2-value signature adaptation
Apr 27, 2026
d2d2596
fix(f7): orchestrator tests — 2-value signature adaptation
Apr 27, 2026
5450826
fix(f11): live_streaming_test.go — sync.Once field adaptation
Apr 27, 2026
aec02c9
fix: system_onboarding_test := to =
Apr 27, 2026
5dc4ea1
fix: remaining biz system/thread/trace test signature
Apr 27, 2026
04ae338
fix: usage_cost_test + usage_log_test signature
Apr 27, 2026
a7c3e2d
fix: CI 阻塞项修复 — go.mod tidy + workflow branch-2 触发 + GOTOOLCHAIN: auto
Apr 28, 2026
6ec9a3e
merge: branch-2 -> branch-1 — 100 项 F-D 安全修复全部验收通过
Apr 29, 2026
9b1652a
fix(bailian): strip response_format and ensure tool arguments are val…
Apr 26, 2026
b0c3fed
test(bailian): add sanitizeForBailian unit tests
Apr 26, 2026
ebe3acd
feat: add spawn_agent tool call arguments sanitizer
Apr 29, 2026
33d9380
merge: branch-2 -> branch-1 — spawn_agent sanitizer 补丁
Apr 29, 2026
fbed41f
fix: sanitize JSON body before storing to Postgres to prevent SQLSTAT…
May 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ on:
- unstable
- development
- 'release/**'
- branch-2
pull_request:
branches:
- unstable
- development
- 'release/**'
- branch-2

env:
GO111MODULE: on
GOTOOLCHAIN: auto

jobs:
build-backend:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ name: Lint
on:
push:
branches:
- 'branch-2'
- 'unstable'
- 'release/**'
pull_request:
branches:
- 'branch-2'
- 'unstable'
- 'release/**'
env:
GO111MODULE: on
GOTOOLCHAIN: auto
jobs:
lint:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ name: Test
on:
push:
branches:
- "branch-2"
- "unstable"
- "release/**"
pull_request:
branches:
- "branch-2"
- "unstable"
- "release/**"
env:
GO111MODULE: on
GOTOOLCHAIN: auto
jobs:
test:
runs-on: ubuntu-latest
Expand Down
5 changes: 2 additions & 3 deletions internal/authz/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ func NewSystemContext(ctx context.Context) context.Context {
return context.WithValue(ctx, principalKey{}, Principal{Type: PrincipalTypeSystem})
}

func WithSystemBypass(ctx context.Context, reason string) context.Context {
bypassCtx, _ := WithBypassPrivacy(NewSystemContext(ctx), reason)
return bypassCtx
func WithSystemBypass(ctx context.Context, reason string) (context.Context, error) {
return WithBypassPrivacy(NewSystemContext(ctx), reason)
}

func RunWithSystemBypass[T any](ctx context.Context, reason string, fn func(ctx context.Context) (T, error)) (T, error) {
Expand Down
99 changes: 96 additions & 3 deletions internal/dumper/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
"context"
"encoding/json"
"fmt"
"log/slog"
"os"
"path/filepath"
"sort"
"sync"
"time"

Expand Down Expand Up @@ -72,7 +74,9 @@ func (d *Dumper) DumpStruct(ctx context.Context, data any, filename string) {
return
}

fmt.Printf("Successfully dumped struct to file: %s\n", fullPath)
d.cleanup()

slog.Info("dumped struct to file", "path", fullPath)
}

// DumpStreamEvents dumps a slice of interface{} as JSONL (JSON Lines) to a file.
Expand Down Expand Up @@ -130,7 +134,9 @@ func (d *Dumper) DumpStreamEvents(ctx context.Context, events []*httpclient.Stre
}
}

fmt.Printf("Successfully dumped stream events to file: %s (count: %d)\n", fullPath, len(events))
d.cleanup()

slog.Info("dumped stream events to file", "path", fullPath, "count", len(events))
}

// DumpBytes dumps raw byte data to a file.
Expand Down Expand Up @@ -171,5 +177,92 @@ func (d *Dumper) DumpBytes(ctx context.Context, data []byte, filename string) {
return
}

fmt.Printf("Successfully dumped bytes to file: %s (size: %d)\n", fullPath, len(data))
d.cleanup()

slog.Info("dumped bytes to file", "path", fullPath, "size", len(data))
}

// cleanup enforces retention policy on dump files: total size, backup count, and max age.
func (d *Dumper) cleanup() {
entries, err := os.ReadDir(d.config.DumpPath)
if err != nil {
return
}

type fileEntry struct {
path string
modTime time.Time
size int64
}

var files []fileEntry
var totalSize int64
maxBytes := int64(d.config.MaxSize) * 1024 * 1024
cutoff := time.Now().Add(-d.config.MaxAge)

for _, e := range entries {
if e.IsDir() {
continue
}
info, err := e.Info()
if err != nil {
continue
}
files = append(files, fileEntry{
path: filepath.Join(d.config.DumpPath, e.Name()),
modTime: info.ModTime(),
size: info.Size(),
})
totalSize += info.Size()
}

// Sort by modification time, oldest first.
sort.Slice(files, func(i, j int) bool {
return files[i].modTime.Before(files[j].modTime)
})

toDelete := make(map[string]struct{})

// 1. Remove files exceeding MaxAge.
for _, f := range files {
if d.config.MaxAge > 0 && f.modTime.Before(cutoff) {
toDelete[f.path] = struct{}{}
}
}

// 2. Remove oldest files until total size is within MaxSize.
if maxBytes > 0 {
remaining := totalSize
for _, f := range files {
if _, ok := toDelete[f.path]; ok {
continue
}
if remaining <= maxBytes {
break
}
toDelete[f.path] = struct{}{}
remaining -= f.size
}
}

// 3. Remove oldest files if count exceeds MaxBackups.
if d.config.MaxBackups > 0 {
kept := 0
for i := len(files) - 1; i >= 0; i-- {
if _, ok := toDelete[files[i].path]; ok {
continue
}
if kept >= d.config.MaxBackups {
toDelete[files[i].path] = struct{}{}
continue
}
kept++
}
}

for path := range toDelete {
if err := os.Remove(path); err != nil {
slog.Warn("failed to remove old dump file", "path", path, "error", err)
}
}
}
13 changes: 12 additions & 1 deletion internal/ent/apikey.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions internal/ent/apikey/apikey.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions internal/ent/apikey/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading