detached 733daad

fix(lint): clean rebased subagent findings

commit
733daadf13a0860b4f5e732eeec71435bcaf525f
author
brice · · 2026-08-05 04:46 UTC
parent
9e6e5b7
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
5 files · +9 -51
M packages/agent/subagents/agent.go +0 -9
@@ -370,15 +370,6 @@ func (a *Agent) SetOnTurnEnd(fn func(step int, errMsg string)) {
370370 }
371371 }
372372
373-func (a *Agent) setStatus(s Status) {
374- a.mu.Lock()
375- a.status = s
376- a.mu.Unlock()
377- if s == StatusRunning {
378- a.setProcessState(ProcessAlive)
379- }
380-}
381-
382373 func (a *Agent) setActivity(msg string) {
383374 a.mu.Lock()
384375 a.activity = strings.TrimSpace(msg)
@@ -370,15 +370,6 @@ func (a *Agent) SetOnTurnEnd(fn func(step int, errMsg string)) {
370 }370 }
371 }371 }
372 372
373-func (a *Agent) setStatus(s Status) {
374- a.mu.Lock()
375- a.status = s
376- a.mu.Unlock()
377- if s == StatusRunning {
378- a.setProcessState(ProcessAlive)
379- }
380-}
381-
382 func (a *Agent) setActivity(msg string) {373 func (a *Agent) setActivity(msg string) {
383 a.mu.Lock()374 a.mu.Lock()
384 a.activity = strings.TrimSpace(msg)375 a.activity = strings.TrimSpace(msg)
M packages/agent/subagents/event.go +1 -1
@@ -297,7 +297,7 @@ func readFollowerEvents(r io.Reader, offset int64) ([]Event, int64) {
297297 ring := newEventRing()
298298 committed := offset
299299 for {
300- line, err, truncated, consumed, complete := readBoundedLineStats(br, maxEventLogLineBytes)
300+ line, truncated, consumed, complete, err := readBoundedLineStats(br, maxEventLogLineBytes)
301301 if !complete {
302302 break
303303 }
@@ -297,7 +297,7 @@ func readFollowerEvents(r io.Reader, offset int64) ([]Event, int64) {
297 ring := newEventRing()297 ring := newEventRing()
298 committed := offset298 committed := offset
299 for {299 for {
300- line, err, truncated, consumed, complete := readBoundedLineStats(br, maxEventLogLineBytes)300+ line, truncated, consumed, complete, err := readBoundedLineStats(br, maxEventLogLineBytes)
301 if !complete {301 if !complete {
302 break302 break
303 }303 }
M packages/agent/subagents/persist.go +4 -3
@@ -470,11 +470,12 @@ func replayEventsIntoAgent(a *Agent, evs []Event) {
470470 case EventTurnResult, "turn_result":
471471 if result, err := decodeTurnResultEvent(ev, a.ID, a.maxOutputBytes, a.maxOutputLines); err == nil {
472472 a.setResult(result)
473- if result.Status == ResultFailed {
473+ switch result.Status {
474+ case ResultFailed:
474475 a.setTurnState(TurnFailed, result.TurnID)
475- } else if result.Status == ResultCanceled {
476+ case ResultCanceled:
476477 a.setTurnState(TurnCanceled, result.TurnID)
477- } else {
478+ default:
478479 a.setTurnState(TurnSucceeded, result.TurnID)
479480 }
480481 }
@@ -470,11 +470,12 @@ func replayEventsIntoAgent(a *Agent, evs []Event) {
470 case EventTurnResult, "turn_result":470 case EventTurnResult, "turn_result":
471 if result, err := decodeTurnResultEvent(ev, a.ID, a.maxOutputBytes, a.maxOutputLines); err == nil {471 if result, err := decodeTurnResultEvent(ev, a.ID, a.maxOutputBytes, a.maxOutputLines); err == nil {
472 a.setResult(result)472 a.setResult(result)
473- if result.Status == ResultFailed {473+ switch result.Status {
474+ case ResultFailed:
474 a.setTurnState(TurnFailed, result.TurnID)475 a.setTurnState(TurnFailed, result.TurnID)
475- } else if result.Status == ResultCanceled {476+ case ResultCanceled:
476 a.setTurnState(TurnCanceled, result.TurnID)477 a.setTurnState(TurnCanceled, result.TurnID)
477- } else {478+ default:
478 a.setTurnState(TurnSucceeded, result.TurnID)479 a.setTurnState(TurnSucceeded, result.TurnID)
479 }480 }
480 }481 }
M packages/agent/subagents/runner.go +4 -24
@@ -6,7 +6,6 @@ import (
66 "context"
77 "encoding/json"
88 "fmt"
9- "io"
109 "os"
1110 "os/exec"
1211 "path/filepath"
@@ -403,7 +402,7 @@ func workerEnvironment(provider string) []string {
403402 var env []string
404403 for _, entry := range os.Environ() {
405404 name, _, ok := strings.Cut(entry, "=")
406- if ok && workerSecretEnvName(name) && !(provider == "amazon-bedrock" && isBedrockCredentialEnv(name)) {
405+ if ok && workerSecretEnvName(name) && (provider != "amazon-bedrock" || !isBedrockCredentialEnv(name)) {
407406 continue
408407 }
409408 env = append(env, entry)
@@ -436,7 +435,7 @@ func workerSecretEnvName(name string) bool {
436435 }
437436
438437 func readBoundedLine(r *bufio.Reader, limit int) ([]byte, error, bool) {
439- line, err, truncated, _, _ := readBoundedLineStats(r, limit)
438+ line, truncated, _, _, err := readBoundedLineStats(r, limit)
440439 return line, err, truncated
441440 }
442441
@@ -444,7 +443,7 @@ func readBoundedLine(r *bufio.Reader, limit int) ([]byte, error, bool) {
444443 // number of source bytes consumed and whether a newline terminated the record.
445444 // The follower uses those extra values to avoid advancing past a partial final
446445 // JSONL record that may be completed by a concurrent append.
447-func readBoundedLineStats(r *bufio.Reader, limit int) ([]byte, error, bool, int64, bool) {
446+func readBoundedLineStats(r *bufio.Reader, limit int) ([]byte, bool, int64, bool, error) {
448447 if limit <= 0 {
449448 limit = 512 * 1024
450449 }
@@ -467,7 +466,7 @@ func readBoundedLineStats(r *bufio.Reader, limit int) ([]byte, error, bool, int6
467466 }
468467 }
469468 if err != bufio.ErrBufferFull {
470- return line, err, truncated, consumed, len(chunk) > 0 && chunk[len(chunk)-1] == '\n'
469+ return line, truncated, consumed, len(chunk) > 0 && chunk[len(chunk)-1] == '\n', err
471470 }
472471 }
473472 }
@@ -684,22 +683,3 @@ func applyEventToSink(ev Event, sink Sink) {
684683 type RunnerFunc func(ctx context.Context, sink Sink) error
685684
686685 func (f RunnerFunc) Run(ctx context.Context, sink Sink) error { return f(ctx, sink) }
687-
688-// streamLines kept around for any caller still using it directly.
689-//
690-// Deprecated: the runner now parses JSONL from stdout via
691-// parseEventLine; this helper is unused inside the package but
692-// remains exported via internal use by tests in the runner_test
693-// suite that pre-date the daemon switch.
694-func streamLines(r io.Reader, fn func(string)) {
695- br := bufio.NewReader(r)
696- for {
697- line, err := br.ReadString('\n')
698- if line != "" {
699- fn(strings.TrimRight(line, "\r\n"))
700- }
701- if err != nil {
702- return
703- }
704- }
705-}
@@ -6,7 +6,6 @@ import (
6 "context"6 "context"
7 "encoding/json"7 "encoding/json"
8 "fmt"8 "fmt"
9- "io"
10 "os"9 "os"
11 "os/exec"10 "os/exec"
12 "path/filepath"11 "path/filepath"
@@ -403,7 +402,7 @@ func workerEnvironment(provider string) []string {
403 var env []string402 var env []string
404 for _, entry := range os.Environ() {403 for _, entry := range os.Environ() {
405 name, _, ok := strings.Cut(entry, "=")404 name, _, ok := strings.Cut(entry, "=")
406- if ok && workerSecretEnvName(name) && !(provider == "amazon-bedrock" && isBedrockCredentialEnv(name)) {405+ if ok && workerSecretEnvName(name) && (provider != "amazon-bedrock" || !isBedrockCredentialEnv(name)) {
407 continue406 continue
408 }407 }
409 env = append(env, entry)408 env = append(env, entry)
@@ -436,7 +435,7 @@ func workerSecretEnvName(name string) bool {
436 }435 }
437 436
438 func readBoundedLine(r *bufio.Reader, limit int) ([]byte, error, bool) {437 func readBoundedLine(r *bufio.Reader, limit int) ([]byte, error, bool) {
439- line, err, truncated, _, _ := readBoundedLineStats(r, limit)438+ line, truncated, _, _, err := readBoundedLineStats(r, limit)
440 return line, err, truncated439 return line, err, truncated
441 }440 }
442 441
@@ -444,7 +443,7 @@ func readBoundedLine(r *bufio.Reader, limit int) ([]byte, error, bool) {
444 // number of source bytes consumed and whether a newline terminated the record.443 // number of source bytes consumed and whether a newline terminated the record.
445 // The follower uses those extra values to avoid advancing past a partial final444 // The follower uses those extra values to avoid advancing past a partial final
446 // JSONL record that may be completed by a concurrent append.445 // JSONL record that may be completed by a concurrent append.
447-func readBoundedLineStats(r *bufio.Reader, limit int) ([]byte, error, bool, int64, bool) {446+func readBoundedLineStats(r *bufio.Reader, limit int) ([]byte, bool, int64, bool, error) {
448 if limit <= 0 {447 if limit <= 0 {
449 limit = 512 * 1024448 limit = 512 * 1024
450 }449 }
@@ -467,7 +466,7 @@ func readBoundedLineStats(r *bufio.Reader, limit int) ([]byte, error, bool, int6
467 }466 }
468 }467 }
469 if err != bufio.ErrBufferFull {468 if err != bufio.ErrBufferFull {
470- return line, err, truncated, consumed, len(chunk) > 0 && chunk[len(chunk)-1] == '\n'469+ return line, truncated, consumed, len(chunk) > 0 && chunk[len(chunk)-1] == '\n', err
471 }470 }
472 }471 }
473 }472 }
@@ -684,22 +683,3 @@ func applyEventToSink(ev Event, sink Sink) {
684 type RunnerFunc func(ctx context.Context, sink Sink) error683 type RunnerFunc func(ctx context.Context, sink Sink) error
685 684
686 func (f RunnerFunc) Run(ctx context.Context, sink Sink) error { return f(ctx, sink) }685 func (f RunnerFunc) Run(ctx context.Context, sink Sink) error { return f(ctx, sink) }
687-
688-// streamLines kept around for any caller still using it directly.
689-//
690-// Deprecated: the runner now parses JSONL from stdout via
691-// parseEventLine; this helper is unused inside the package but
692-// remains exported via internal use by tests in the runner_test
693-// suite that pre-date the daemon switch.
694-func streamLines(r io.Reader, fn func(string)) {
695- br := bufio.NewReader(r)
696- for {
697- line, err := br.ReadString('\n')
698- if line != "" {
699- fn(strings.TrimRight(line, "\r\n"))
700- }
701- if err != nil {
702- return
703- }
704- }
705-}
M packages/agent/subagents/scheduler.go +0 -14
@@ -278,20 +278,6 @@ func (f *Supervisor) armQueueTimeout(a *Agent) {
278278
279279 func (f *Supervisor) expireQueued(id string) { f.cancelQueued(id, context.DeadlineExceeded) }
280280
281-func (f *Supervisor) removeQueued(a *Agent) {
282- if a == nil {
283- return
284- }
285- f.mu.Lock()
286- for i, queued := range f.queue {
287- if queued == a {
288- f.queue = append(f.queue[:i], f.queue[i+1:]...)
289- break
290- }
291- }
292- f.mu.Unlock()
293-}
294-
295281 func (f *Supervisor) cancelQueued(id string, cause error) {
296282 a := f.Get(id)
297283 if a == nil {
@@ -278,20 +278,6 @@ func (f *Supervisor) armQueueTimeout(a *Agent) {
278 278
279 func (f *Supervisor) expireQueued(id string) { f.cancelQueued(id, context.DeadlineExceeded) }279 func (f *Supervisor) expireQueued(id string) { f.cancelQueued(id, context.DeadlineExceeded) }
280 280
281-func (f *Supervisor) removeQueued(a *Agent) {
282- if a == nil {
283- return
284- }
285- f.mu.Lock()
286- for i, queued := range f.queue {
287- if queued == a {
288- f.queue = append(f.queue[:i], f.queue[i+1:]...)
289- break
290- }
291- }
292- f.mu.Unlock()
293-}
294-
295 func (f *Supervisor) cancelQueued(id string, cause error) {281 func (f *Supervisor) cancelQueued(id string, cause error) {
296 a := f.Get(id)282 a := f.Get(id)
297 if a == nil {283 if a == nil {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 477

↑↓ moveenter openesc close