Skip to content

Refactor/split agent go#503

Merged
AbirAbbas merged 4 commits intoAgent-Field:mainfrom
nikzor:refactor/split-agent-go
Apr 28, 2026
Merged

Refactor/split agent go#503
AbirAbbas merged 4 commits intoAgent-Field:mainfrom
nikzor:refactor/split-agent-go

Conversation

@nikzor
Copy link
Copy Markdown
Contributor

@nikzor nikzor commented Apr 27, 2026

What was extracted

  1. agent_register.go
    • RegisterReasoner
  2. agent_lifecycle.go
    • Initialize
    • Run
    • Serve
    • registerNode
    • waitForApproval
    • markReady
    • startServer
    • startLeaseLoop
    • shutdown
    • registeredHeartbeatInterval
  3. agent_did.go
    • DIDManager
    • VCGenerator
    • initializeDIDSystem
    • fillDIDContext
    • maybeGenerateVC
    • shouldGenerateVC

Before / After size

  • Before (agent.go): 2184 LOC (issue baseline)
  • After (agent.go): 1713 LOC

Commits

  • a902eed refactor(sdk-go): split reasoner registration methods
  • 09c77bd refactor(sdk-go): split agent lifecycle methods
  • 2cb21f1 refactor(sdk-go): split DID and VC methods

Test evidence

Ran the required package tests after each extraction and at the end:

  • cd sdk/go && go test ./agent/... -count=1
    Final result:
  • ok github.com/Agent-Field/agentfield/sdk/go/agent

Related issues

Fixes #413

nikzor added 3 commits April 27, 2026 14:55
Move RegisterReasoner out of agent.go into agent_register.go as a pure file split to reduce file size and keep behavior unchanged.

Made-with: Cursor
Move lifecycle and server orchestration methods out of agent.go into agent_lifecycle.go with no behavior changes.

Made-with: Cursor
Move DID initialization and VC helper methods out of agent.go into agent_did.go as pure method moves.

Made-with: Cursor
@nikzor nikzor requested review from a team and AbirAbbas as code owners April 27, 2026 15:48
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 27, 2026

CLA assistant check
All committers have signed the CLA.

@AbirAbbas AbirAbbas enabled auto-merge April 27, 2026 16:02
AbirAbbas
AbirAbbas previously approved these changes Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Performance

SDK Memory Δ Latency Δ Tests Status
Go 222 B -21% 0.61 µs -39%

✓ No regressions detected

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 86%, aggregate ≥ 88%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 87.40% 87.30% ↑ +0.10 pp 🟡
sdk-go 91.60% 90.70% ↑ +0.90 pp 🟢
sdk-python 93.63% 93.63% ↑ +0.00 pp 🟢
sdk-typescript 92.63% 92.56% ↑ +0.07 pp 🟢
web-ui 90.03% 90.01% ↑ +0.02 pp 🟢
aggregate 89.06% 89.01% ↑ +0.05 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 394 87.00%
sdk-python 0 ➖ no changes
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

@AbirAbbas AbirAbbas disabled auto-merge April 27, 2026 16:07
@AbirAbbas
Copy link
Copy Markdown
Contributor

AbirAbbas commented Apr 27, 2026

appreciate the PR! needs more test coverage from coverage-summary ci

Add focused tests for the new lifecycle, DID, and registration files
@nikzor
Copy link
Copy Markdown
Contributor Author

nikzor commented Apr 28, 2026

@AbirAbbas Could you please check it again

@AbirAbbas AbirAbbas added this pull request to the merge queue Apr 28, 2026
Merged via the queue into Agent-Field:main with commit d315eab Apr 28, 2026
19 checks passed
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.

[Refactor] Split sdk/go/agent/agent.go (2184 LOC)

3 participants