Commit 61007bd
committed
fix: migrate daemon and multiagent to Session sub-service APIs
Replace direct writes to the deprecated legacy Session fields
(sess.Autonomy, sess.MaxTurns) with the canonical PermSvc / Session
setters:
- sess.Autonomy = X -> sess.PermSvc().SetAutonomy(X)
- sess.MaxTurns = N -> sess.SetMaxTurns(N)
The god-object decomposition (Phases 2-3, see
docs/session-decomposition.md) extracted Autonomy into PermissionService
and MaxTurns into Session.SetMaxTurns. Reading sess.Autonomy directly
now bypasses the service and silently desynchronises the two views.
The daemons's handleChat previously wrote sess.MaxTurns without
checking the error path; SetMaxTurns returns an error for negative
values, so the HTTP handler now surfaces 400 Bad Request on invalid
input. The two mission workers (EngineWorker and ReadOnlyValidationWorker)
already validate the surrounding worktree setup, so they wrap the
error and return it the same way as their other failure modes.
Touches:
- internal/daemon/daemon.go (Autonomy setter, Autonomy read-back,
MaxTurns error path)
- internal/daemon/daemon_test.go (MaxTurns setter, error check)
- internal/multiagent/worker.go (both EngineWorker and
ReadOnlyValidationWorker)
Verification:
- go vet ./... -> clean
- staticcheck ./... -> 0 issues (was 12 SA1019)
- gofumpt -d -> clean
- go build ./... -> clean
- go test -short ./... -> all packages pass1 parent 3bf56fc commit 61007bd
3 files changed
Lines changed: 24 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
414 | 418 | | |
415 | 419 | | |
416 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | | - | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | | - | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
| |||
0 commit comments