4.1 KiB
4.1 KiB
spec, created, status
| spec | created | status |
|---|---|---|
| docs/specs/platform/requirements/expected-runtime-log-severity.md | 2026-08-23 | implemented |
Implementation Plan: Expected runtime log severity
Overview
Classify two confirmed normal conditions at their correct severity. First,
workspace file reads will expose missing current-checkout paths as NotFound
and debug evidence. Second, initial worktree persistence that races task
environment creation will remain successful but emit debug evidence instead of
a warning. Non-missing file failures and non-environment worktree failures keep
their existing behavior.
Backend
Workspace file content classification
- Preserve the server-side
fs.ErrNotExistdistinction inapps/backend/internal/agentctl/server/process/workspace_files.goand carry it across the agentctl HTTP boundary as HTTP 404. - Map that status to a typed client sentinel, then have
apps/backend/internal/agent/handlers/workspace_file_handlers.gouse the sentinel inwsGetFileContentto log the expected condition at debug level and returnws.ErrorCodeNotFound. - Leave non-missing errors on the current error-level and
ws.ErrorCodeInternalErrorpath. - Add focused coverage for the server status, client sentinel, handler logs, and genuine stat-failure path.
Initial worktree persistence severity
- Update
apps/backend/internal/worktree/manager_state.goso only theErrEnvironmentNotResolvedbranch uses debug severity. Keep the message fields and return behavior stable. - Add observer-backed coverage in
apps/backend/internal/worktree/manager_state_test.gofor the typed environment-not-resolved branch and verify that unrelated store errors still follow the current error path.
Tests
- What: Missing current-checkout file returns
not_foundand emits debug, while a non-missing dependency failure remainsinternal_errorand error. File:apps/backend/internal/agent/handlers/workspace_file_handlers_test.go. How: Use the realagentctl.Clientagainst anhttptest.Serverand a zap observer logger attached to the handler. - What: Initial worktree persistence is debug-only and remains successful;
other store errors remain failures.
File:
apps/backend/internal/worktree/manager_state_test.go. How: Call the realManager.persistWorktreewith a focused fake store returning typed errors and an observer logger. Do not create a Git worktree.
Verification Results
cd apps/backend && go test ./internal/agent/handlers -run 'TestWorkspaceFileHandlers(Missing|NonMissing).*' -count=1passed after the workspace-file change and final formatting.cd apps/backend && go test ./internal/worktree -run 'TestPersistWorktree_(EnvironmentNotResolved|OtherStoreError)' -count=1passed after the worktree change and final formatting.cd apps/backend && go test ./internal/agent/handlers ./internal/worktree -count=1passed: both packages green.- PR fixup RED: the client and process tests initially failed to compile
without the new
ErrFileNotFoundsentinels; the API rejection test reported a missing file as 400; and the handler regression classified a 400 response containing a legacyfile not foundmessage asNOT_FOUND. - PR fixup GREEN:
cd apps/backend && go test ./internal/agent/runtime/agentctl -run 'TestRequestFileContent_(Surfaces|DoesNot).*' -count=1passed;cd apps/backend && go test ./internal/agentctl/server/process -run TestReadFileContent_PermissionErrorIsNotMissing -count=1passed;cd apps/backend && go test ./internal/agentctl/server/api -run TestHandleFileContent_Rejections -count=1passed; andcd apps/backend && go test ./internal/agent/handlers -run 'TestWorkspaceFileHandlers(Missing|NonMissing).*' -count=1passed.
Implementation Waves And Parallel Candidates
Execute sequentially in the primary session. The tasks touch disjoint backend packages, but no delegation is authorized by this plan.
Open Questions
None.