Skip to content

refactor: eliminate duplicate code across LLM provider and agent layers - #108

Open
BaSui01 wants to merge 10 commits into
masterfrom
codex/-tdd-pr
Open

refactor: eliminate duplicate code across LLM provider and agent layers#108
BaSui01 wants to merge 10 commits into
masterfrom
codex/-tdd-pr

Conversation

@BaSui01

@BaSui01 BaSui01 commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary

Eliminated ~243 lines of duplicate code, added ~134 lines of shared infrastructure.

LLM Provider

  • New openai_sdk_helpers.go: merge buildSDKResponseToolChoice + buildSDKInputTokenToolChoice
  • New llmcore.InvokeChat(): eliminate 3 duplicate gateway invoke patterns
  • New types.NewSimpleChatRequest(): used by 4 adapter files

Agent Layer

  • Replace 30+ inline Message{Role:X} with NewUserMessage/NewSystemMessage helpers
  • Clean remaining inline Message in prompt_context_runtime.go + react.go
  • 56 files: +1707 / -1395 lines

BaSui and others added 6 commits May 12, 2026 01:36
… GitHub Actions

- Update CI workflow and golangci configuration
- Clean up .arts and .codeartsdoer artifacts
- Add dev-to-master auto-merge workflow
- Update .gitignore and config/api.go
- align go-arch-lint with recursive package matching and guard pkg/httpclient
- repair coverage and benchmark package gates used by CI
- remove broken dev-to-master auto-merge workflow
- fix flaky/runtime tests and offline tokenizer coverage
- add durable memory backend tests required by current package set

Co-authored-by: Codex <noreply@openai.com>
- split overloaded tools capabilities into registry/discovery/execution/remote/store helpers while keeping root facades
- unify tokenizer contracts and execution option clone generation
- improve provider multimodal reuse, RAG runtime performance, DAG scheduling, memory persistence, guardrails authz, streaming reliability, and handler error utilities
- add focused regression and coverage tests for the open issue set

Fixes #13
Fixes #14
Fixes #15
Fixes #25
Fixes #26
Fixes #27
Fixes #28
Fixes #29
Fixes #33
Fixes #39
Fixes #44
Fixes #45
Fixes #81

Co-authored-by: Codex <noreply@openai.com>
LLM Provider Layer:
- Extract shared tool_choice resolution into openai_sdk_helpers.go
- Merge buildSDKResponseToolChoice + buildSDKInputTokenToolChoice (~47 lines)
- Add llmcore.InvokeChat() helper to eliminate 3 duplicate gateway invoke patterns
- Add types.NewSimpleChatRequest() factory for 4 adapter files

Agent Layer:
- Replace 30+ inline Message{Role:X} with existing NewUserMessage/NewSystemMessage
- Unify ChatRequest construction via types.NewSimpleChatRequest
- Clean remaining inline Message in prompt_context_runtime.go and react.go

Docs & infra sync: README, architecture docs, routes, resilience configs

Net: ~243 lines of duplicate code eliminated, 134 lines of shared infrastructure added
Copilot AI review requested due to automatic review settings May 13, 2026 18:38
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

BaSui added 4 commits May 14, 2026 02:45
- README/README_EN version bump
- docs: update CN/EN tutorials and navigation
- llm/gateway: optimizations
- rag/runtime: hybrid retrieval improvements
- workflow/core: dag executor fixes
- agent: a2a client, hierarchical agent fixes
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.

2 participants