Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d0ba785
fix(sessions): reliably deliver startup user messages via event queue
jh0904 Jul 30, 2026
2151cf7
test(sessions): keep core startup delivery coverage only
jh0904 Jul 30, 2026
4029d81
refactor(sessions): simplify startup queue handoff after review
jh0904 Jul 30, 2026
112e515
fix(sessions): only queue startup messages for cloud environments
jh0904 Jul 30, 2026
6c573f5
fix(db): use stable tenant UUIDs for startup queue
jh0904 Jul 31, 2026
73b2d10
fix(sessions): reinject session history when activating code sessions
jh0904 Jul 31, 2026
7eef483
refactor(db): rename session startup window helper
arthur-zhang Jul 31, 2026
c79cbf5
refactor(db): simplify session event queue existence check
arthur-zhang Jul 31, 2026
2c06800
refactor(db): simplify listSessionEventQueueIdentityRows
arthur-zhang Jul 31, 2026
ee3eee6
refactor(db): simplify ListSessionEventQueueItems event lookup
arthur-zhang Jul 31, 2026
e05b3c7
refactor(db): simplify delete session event queue query
arthur-zhang Jul 31, 2026
f55b5ab
Merge origin/main into codex/fix-session-event-reliable-delivery
jh0904 Jul 31, 2026
88033f5
fix(db): renumber session event queue migration after main UUID series
jh0904 Jul 31, 2026
3609ca3
revert: drop unrelated merge fixes from startup-delivery branch
jh0904 Jul 31, 2026
c5a63a4
refactor(db): simplify startup queue SQL and drop cloud filter docs
jh0904 Jul 31, 2026
1ccc6fc
Merge remote-tracking branch 'origin/main' into codex/fix-session-eve…
jh0904 Jul 31, 2026
080310a
refactor(sessions): move activation tx orchestration out of DB
jh0904 Jul 31, 2026
56afac5
refactor(sessions): clarify startup queue delivery and activation han…
jh0904 Aug 1, 2026
3fa3cbe
fix(sessions): atomically replay activation history
jh0904 Aug 1, 2026
c8c0ed0
Migrate session activation SQL to generated yourbatis mappers
arthur-zhang Aug 3, 2026
5ea177c
refactor(db): migrate single code-session event append to yourbatis
jh0904 Aug 3, 2026
d3e211a
fix(ci): generate yourbatis mappers before Go typecheck
jh0904 Aug 3, 2026
f65c999
merge origin/main into session startup delivery branch
jh0904 Aug 3, 2026
c7c4c90
merge origin/main into session startup delivery branch
jh0904 Aug 4, 2026
8819d86
fix: reliably deliver startup session events
jh0904 Aug 4, 2026
4d76cdb
refactor(db): clarify code-session append naming and comments
jh0904 Aug 4, 2026
2b1bdee
fix(sessions): harden activation replay
jh0904 Aug 4, 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
7 changes: 7 additions & 0 deletions .github/workflows/complexity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
pull_request:
paths:
- '**/*.go'
- 'internal/db/*.xml'
- '.golangci-complexity.yml'
- 'go.mod'
- 'go.sum'
- 'scripts/generate-go.sh'
- 'scripts/go-complexity.sh'
- 'web/**'
- '.github/workflows/complexity.yml'
Expand All @@ -15,9 +17,11 @@ on:
- main
paths:
- '**/*.go'
- 'internal/db/*.xml'
- '.golangci-complexity.yml'
- 'go.mod'
- 'go.sum'
- 'scripts/generate-go.sh'
- 'scripts/go-complexity.sh'
- 'web/**'
- '.github/workflows/complexity.yml'
Expand All @@ -44,6 +48,9 @@ jobs:
go-version-file: go.mod
cache: true

- name: Generate Go sources
run: ./scripts/generate-go.sh

- name: Check Go complexity
uses: golangci/golangci-lint-action@v9
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/dead-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ on:
pull_request:
paths:
- '**/*.go'
- 'internal/db/*.xml'
- '.golangci-dead-code.yml'
- 'go.mod'
- 'go.sum'
- 'scripts/generate-go.sh'
- 'scripts/go-dead-code.sh'
- '.github/workflows/dead-code.yml'
push:
branches:
- main
paths:
- '**/*.go'
- 'internal/db/*.xml'
- '.golangci-dead-code.yml'
- 'go.mod'
- 'go.sum'
- 'scripts/generate-go.sh'
- 'scripts/go-dead-code.sh'
- '.github/workflows/dead-code.yml'

Expand All @@ -42,6 +46,9 @@ jobs:
go-version-file: go.mod
cache: true

- name: Generate Go sources
run: ./scripts/generate-go.sh

- name: Detect unreachable Go declarations
uses: golangci/golangci-lint-action@v9
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
go-version-file: go.mod
cache: true

- name: Generate Go sources
run: ./scripts/generate-go.sh

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ logs/
CLAUDE.local.md
AGENTS.override.md
.worktrees/
*.gen.go
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ repos:
types: [go]

- id: golangci-lint
name: Lint packages containing staged Go files
name: Lint packages containing staged Go inputs
entry: scripts/pre-commit-go-lint.sh
language: script
types: [go]
files: ^(?:.*\.go|internal/db/.*\.xml|go\.(?:mod|sum)|scripts/generate-go\.sh)$
require_serial: true

- id: go-dead-code
name: Detect unreachable Go declarations
entry: scripts/go-dead-code.sh
language: script
files: ^(?:.*\.go|\.golangci-dead-code\.yml|go\.(?:mod|sum)|scripts/go-dead-code\.sh)$
files: ^(?:.*\.go|internal/db/.*\.xml|\.golangci-dead-code\.yml|go\.(?:mod|sum)|scripts/(?:generate-go|go-dead-code)\.sh)$
pass_filenames: false
require_serial: true

- id: go-complexity
name: Enforce Go cyclomatic complexity
entry: scripts/go-complexity.sh
language: script
files: ^(?:.*\.go|\.golangci-complexity\.yml|go\.(?:mod|sum)|scripts/go-complexity\.sh)$
files: ^(?:.*\.go|internal/db/.*\.xml|\.golangci-complexity\.yml|go\.(?:mod|sum)|scripts/(?:generate-go|go-complexity)\.sh)$
pass_filenames: false
require_serial: true

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /oma-server .
RUN go generate ./internal/db \
&& CGO_ENABLED=0 go build -ldflags="-s -w" -o /oma-server .

# ---- 前端构建 (Bun) ---------------------------------------------------------
FROM ${REGISTRY}/node:22 AS web-builder
Expand Down
8 changes: 8 additions & 0 deletions docs/design/be/ccrv2/ccr-v2-epoch-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ update code_sessions sequence_num
commit()
```

该事务由共享的 `yourbatis.DB.Transaction` 创建;回调中的同一个事务 `Executor`
同时构造 `CodeSessionMapper`、`CodeSessionInboundEventMapper` 和
`CodeSessionOutboundEventMapper`。`CodeSessionMapper.LockCodeSessionByExternalID`
负责日常 append 的行锁,不附加 `initializing` 状态限制;启动激活仍使用独立的
`LockInitializingCodeSession`。方向对应的 event mapper 在锁内完成幂等单条查询和
`INSERT ... RETURNING`,随后由 `CodeSessionMapper` 更新对应方向的 sequence。
激活使用的 inbound 批量 insert 保持独立,不经过单条 append。

这样线性化语义才成立:

- 如果旧 worker 先拿到锁并写完,再发生 register,则这次写入发生在抢占之前,可以接受。
Expand Down
Loading