Skip to content

fix(agent): report approvals by status and log each tool call - #40

Merged
bketelsen merged 2 commits into
mainfrom
fix/sweep-35-36-38-39
Nov 13, 2026
Merged

bketelsen merged 2 commits into
mainfrom
fix/sweep-35-36-38-39

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes 4 sweep findings in 1 change set.

Fixes #35
Fixes #36
Fixes #38
Fixes #39

Risk tier

Risk tier: 3. The PR touches L1 paths in .github/risk-paths.json:

  • internal/agent/agent.go (auth: the approval cards). The change is safe: call wraps the old body (renamed runCall, unchanged) with a timer and a log line. outcome changes only the text that describes a past approval card to the model. No rule on what runs, what becomes an approval, or which ids a change may take is changed.
  • internal/agent/own.go (auth: the check that a card can be confirmed). The change is safe: it adds 1 log line after the existing call in Confirm and in approve. The pending check, the argument handling and the call are unchanged.
  • api/activity.go (auth: the callers each activity method admits). The change is safe: only the doc comments of Last and LastOK change. The types, the JSON names and the method admissions are unchanged.

The log lines carry only the app id, the tool name, the card kind, the status and the duration. TestEachToolCallIsLoggedWithoutItsContent checks that no argument, result or refusal text reaches the log.

Verification

  • make ci green (host and nsl): make verify (gofmt, go mod tidy -diff, vet, golangci-lint 0 issues, go test ./...), make race, and make web-check (tsc, vitest: 8 files, 98 tests).
  • Revert test: in a scratch worktree at de8a438, run git checkout 1f7185f -- internal/agent/agent.go internal/agent/own.go && go test ./internal/agent/. These tests fail on assertions: TestOutcomeOfAnApprovalFollowsItsStatus (pending and cancelled read as Done: …), TestTheSearchedHistorySaysAnApprovalWaits (search_thread lacks "waits for their approval"), TestEachToolCallIsLoggedWithoutItsContent (logged 0 tool calls, want 2) and TestCaptureWaitsForTheOwner (the confirmed append is not logged).
  • sweep: Routine.last says when it last ran, but it holds the last scheduled run #38 and sweep: the design names tools notes.read_note, but porterd names them notes__read_note #39 change only docs and a label. web/test/activity.test.ts now checks the Last scheduled label.
  • Blocking review point fixed: guard added and 1 .memory/corrections.jsonl line added. The cross-review of de8a438 found that a made-up function name (an unknown tool, or a call whose arguments are not JSON) reached the log, and such a name can hold owner content. Since 831b400, Agent.call logs the app and the tool only for a name that Registry.Lookup offers. Any other name logs as (unknown). Guard: TestAToolNameTheRegistryDoesNotKnowIsNotLogged. With only the call change reverted (scratch worktree at 831b400, agent.go from de8a438), the guard fails: "the log holds Secret_Plan_token_123 / Secret_Name_456 / Secret_789".

Cross-review

  • Coder: deepseek/deepseek-flash, with small edits by anthropic/claude-opus-5-5. Reviewer: openai/gpt-6.1-sol.
  • Initial review of 1f7185f..de8a438: Not ready, 1 blocking finding (above). It found no other issue.
  • Re-review 1 of de8a438..831b400: Ready, Blocking: none. Reviewed head: 831b4001c57567ce01c0f3e0add044265b45bca5.

- outcome: a routine's approval card reads by its status in the history
  and in search_thread (pending: it waits for the owner; dismissed:
  nothing was done; approved: done or failed), not as "Done".
- Each tool call is logged with its app, tool, kind, status and duration,
  never its arguments, result or text: the model's calls, a confirmed
  capture and an approved action, as docs/design/overview.md and AGENTS.md
  state.
- Routine.last and lastOk are the last scheduled run's, as
  docs/specs/routines.md says a run now moves neither; the schema, the
  api comments and the web label ("Last scheduled") now say so.
- docs/design/overview.md names tools as porterd does (notes__read_note).

Fixes #35
Fixes #36
Fixes #38
Fixes #39
@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a path in .github/risk-paths.json labels Nov 13, 2026
The model writes a call's function name and can put owner content in a
made-up one. A tool call's log line now takes the app and the tool from
the name only when the registry offers it; any other name logs as
(unknown). Guarded by TestAToolNameTheRegistryDoesNotKnowIsNotLogged and
recorded in .memory/corrections.jsonl.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
@bketelsen
bketelsen merged commit 8b1fe6d into main Nov 13, 2026
8 checks passed
@bketelsen
bketelsen deleted the fix/sweep-35-36-38-39 branch November 13, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L1 Read every line ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

2 participants