Skip to content

fix(daemon): add operation-specific error context#122

Merged
rowan-stein merged 2 commits into
mainfrom
noa/issue-120-error-context
May 13, 2026
Merged

fix(daemon): add operation-specific error context#122
rowan-stein merged 2 commits into
mainfrom
noa/issue-120-error-context

Conversation

@casey-brooks
Copy link
Copy Markdown
Contributor

Summary

  • Add operation-specific wrapping for timeout/cancel errors in sync page fetch, Codex start turn, publish, ack, keepalive touch, Codex wait completion, and process signal shutdown paths.
  • Preserve existing timeout durations and control-flow semantics while making daemon logs actionable.
  • Add focused unit coverage for page fetch, keepalive, Codex start/wait, and shutdown wrapping.

Fixes #120

Test & Lint Summary

  • nix shell nixpkgs#gcc -c sh -c 'go test ./... && go vet ./... && go build ./...'
    • Tests: 178 passed / 0 failed / 0 skipped
    • Lint: go vet ./... passed with no errors
    • Build: go build ./... passed
  • nix shell nixpkgs#gcc -c sh -c 'AGN_REPO_PATH=/workspace/agn-cli OPENAI_API_KEY=test-key go test -v -count=1 -tags e2e ./test/e2e/'
    • E2E tests: 2 passed / 0 failed / 0 skipped

@casey-brooks
Copy link
Copy Markdown
Contributor Author

Test & Lint Summary

  • nix shell nixpkgs#gcc -c sh -c 'go test ./... && go vet ./... && go build ./...'
    • Tests: 178 passed / 0 failed / 0 skipped
    • Lint: go vet ./... passed with no errors
    • Build: go build ./... passed
  • nix shell nixpkgs#gcc -c sh -c 'AGN_REPO_PATH=/workspace/agn-cli OPENAI_API_KEY=test-key go test -v -count=1 -tags e2e ./test/e2e/'
    • E2E tests: 2 passed / 0 failed / 0 skipped

Copy link
Copy Markdown

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

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

Starting review.

Comment thread internal/daemon/daemon.go
Copy link
Copy Markdown

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

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

Thanks for tightening the timeout/cancel wrapping. I found one blocking gap: handler/turn failures still fall back to the generic sync error path, so the issue’s requested operation-specific logging is not yet complete.

@casey-brooks
Copy link
Copy Markdown
Contributor Author

Follow-up Changes

  • Addressed Noa's review by wrapping handler/turn failure paths with stable operation context before they bubble out of sync handling.
  • Added agn_turn, claude_turn, and codex_turn_result wrapping for AGN/Claude turn failures, empty responses, and Codex turn-result failures.
  • Kept sync_page_fetch reserved for page fetch failures instead of wrapping handler errors in the generic sync path.

Test & Lint Summary

  • nix shell nixpkgs#gcc -c sh -c 'go test ./... && go vet ./... && go build ./...'
    • Tests: 180 passed / 0 failed / 0 skipped
    • Lint: go vet ./... passed with no errors
    • Build: go build ./... passed
  • nix shell nixpkgs#gcc -c sh -c 'AGN_REPO_PATH=/workspace/agn-cli OPENAI_API_KEY=test-key go test -v -count=1 -tags e2e ./test/e2e/'
    • E2E tests: 2 passed / 0 failed / 0 skipped

Copy link
Copy Markdown

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

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

Re-review complete. The prior blocker is resolved: handler failures now retain operation-specific context for AGN/Claude turns and Codex turn results, and the generic sync wrapper no longer masks those paths. I also verified the updated test coverage and ran buf generate ... && go test ./... successfully.

@rowan-stein rowan-stein merged commit bde003d into main May 13, 2026
2 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.

Remove per-turn completion timeout; fix agynd startup order; add sync retry/backoff

3 participants