Skip to content

Consolidation: goal recovery handoffs, trigger agents made like --new, test races - #476

Merged
lydakis merged 4 commits into
mainfrom
claude/project-thread-554bbo
Oct 31, 2026
Merged

lydakis merged 4 commits into
mainfrom
claude/project-thread-554bbo

Conversation

@lydakis

@lydakis lydakis commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Part of the consolidation cycle from an external review of main at 52c844a. I re-checked each finding against 5f2c126. #422 was already fixed by #442. This PR fixes what was still true in goals, triggers and tests. MCP host bounds and ACP identity (#347, #335, #332) are in a parallel thread, and #317 is in the person-label PR.

Goals: accepted work ends visibly (#355)

  • A completion during a check is no longer dropped. When a turn completes while the goal's check of an earlier turn runs, the lookout holds it and checks it once that check settles. If the agent has already gone on in a newer turn, that newer turn gets checked and the held one is told as plain news. This is the Kubernetes work-queue rule for an item re-added while it is being processed. It fixes the replay case: after a restart that replays two finished goal turns, the check's continuation returns the second, already finished turn, and the goal used to sit idle.
  • A changed continuation counts as going on. A replayed continuation whose prompt changed (the daemon answers idempotency_conflict) means the agent already went on. It is no longer told as "could not go on".
  • How a goal ended survives a restart. Every ending (met, gave up, budget, idle) is written to STORE.lookout/goals/ended/BOT.json before the goal file goes, like a Job's terminal condition. This replaces met/, which recorded success only. A lookout that restarts before the lead heard reads the outcome from there, so the lead still hears that the goal gave up or ran out of budget. The roster's checked reads met from the same note.

The sandboxed-check part of #355 needs a daemon op, so it stays open for discussion.

Trigger --start agents get the same policy as --new (#404)

  • sonny --new and a trigger's --start now make agents through one made(): Sonny's tools, an auto gate, the workspace-write sandbox, the person's fallback, cache lifetime and hide_senders. There's one way in, so an agent nobody opens never has more reach than one they do. A doubted call waits in /approvals, as any agent's does.
  • An agent an older trigger made, with no sandbox and no gate, is confined at its next fire. One the person put in full names its sandbox, so it stays as it is.
  • The memory cleanup works under the sandbox: memory goes through the lookout-served memory tool, the --if gate runs as the trigger, outside the agent, and the folder is its workspace.

Also

Tests

  • New runtime tests: test_two_goal_turns_that_ended_while_the_lookout_was_down_are_both_checked and test_how_a_goal_ended_reaches_the_lead_after_a_restart.
  • The trigger --start test now checks the auto gate and the sandbox. There's a unit test for which agents get confined at their next fire.
  • Run locally: cargo test -p sonny (613 passed), clippy and fmt, and tests.test_served, tests.test_trigger and tests.test_soak with bubblewrap (51 OK).

…policy, test races

- Goals (#355): a turn that completes while its goal's check runs is held and
  checked once that check settles, unless the agent goes on in a newer turn,
  as a work queue processes an item re-added during processing again. After a
  restart that replays two finished goal turns, the second is no longer
  dropped. A replayed continuation whose prompt changed (idempotency_conflict)
  counts as going on, not as a failure.
- Goals (#355): every ending is noted in STORE.lookout/goals/ended/BOT.json
  (was met/, success only) before the goal file goes, so a lookout that
  restarts before the lead heard still tells how the goal ended.
- Triggers (#404): `--start` agents are made through the same `made()` as
  `sonny --new`: auto gate, workspace-write sandbox, fallback. Agents an older
  trigger made with no sandbox and no gate are confined at their next fire.
- Sonny reconcile reads every page of a project's bots (#150).
- Tests: node scripts get 60 s under test (#418); test_served's /proc wait
  tolerates the process going between looks; the soak names why its events
  connection closed and keeps the daemon's stderr.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHQFvDYzqCcbhWmojA
@lydakis lydakis self-assigned this Oct 31, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T03:33:05.978547Z 941493d New commits
🔒 Security Review ✅ Completed 2026-10-31T03:33:54.398912Z 941493d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d3dbe8ad5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/lookout/goals.rs Resolved
Comment thread sonny/src/lookout/goals.rs Resolved
…ts never drop

Codex review on #476: an idempotency_conflict names the turn the request
started, so it counts as the turn the agent goes on in, and the newer-turn
rule holds with changed check output. The settlement channel is unbounded,
holding a few per agent with a goal at most, since a goal's turn waits on
its one settlement and a full channel dropped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHQFvDYzqCcbhWmojA

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0e662774f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/lookout/goals.rs Resolved
Comment thread sonny/src/lookout/goals.rs Resolved

lydakis commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

The runtime job failed on 941493d in one daemon test: test_answered's test_a_later_calls_gate_that_lapses_ends_the_wait_for_an_answer. It isn't caused by this PR. The PR touches no daemon code and none of that test's paths, and the test passed in five local runs on this head and in the earlier CI runs of this PR. It's a timing race between the test's 100 ms approval expiry and the declared call starting on a busy runner. I filed it as #484, with two possible fixes. A test-only fix is the simple one. Fixing it in the daemon would change behavior, so that needs a discussion first. I couldn't re-run the job from here (the API returns 403). rust and macos are green, and every other runtime module passed, including test_served, test_trigger and test_soak.


Generated by Claude Code

@lydakis
lydakis merged commit e3f2fa2 into main Oct 31, 2026
3 of 4 checks passed
lydakis added a commit that referenced this pull request Oct 31, 2026
…urn (#497)

* Consolidation from the external review: goal recovery, trigger agent policy, test races

- Goals (#355): a turn that completes while its goal's check runs is held and
  checked once that check settles, unless the agent goes on in a newer turn,
  as a work queue processes an item re-added during processing again. After a
  restart that replays two finished goal turns, the second is no longer
  dropped. A replayed continuation whose prompt changed (idempotency_conflict)
  counts as going on, not as a failure.
- Goals (#355): every ending is noted in STORE.lookout/goals/ended/BOT.json
  (was met/, success only) before the goal file goes, so a lookout that
  restarts before the lead heard still tells how the goal ended.
- Triggers (#404): `--start` agents are made through the same `made()` as
  `sonny --new`: auto gate, workspace-write sandbox, fallback. Agents an older
  trigger made with no sandbox and no gate are confined at their next fire.
- Sonny reconcile reads every page of a project's bots (#150).
- Tests: node scripts get 60 s under test (#418); test_served's /proc wait
  tolerates the process going between looks; the soak names why its events
  connection closed and keeps the daemon's stderr.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHQFvDYzqCcbhWmojA

* Goals: a changed continuation is the turn the daemon names; settlements never drop

Codex review on #476: an idempotency_conflict names the turn the request
started, so it counts as the turn the agent goes on in, and the newer-turn
rule holds with changed check output. The settlement channel is unbounded,
holding a few per agent with a goal at most, since a goal's turn waits on
its one settlement and a full channel dropped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHQFvDYzqCcbhWmojA

* Goals: a deferred check holds its turn from when it starts; a replay counts idle turns from before the check it reruns

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHQFvDYzqCcbhWmojA

* Sonny: date the person's words by when each was written, not by its turn

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHQFvDYzqCcbhWmojA

---------

Co-authored-by: Claude <[email protected]>
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.

2 participants