Skip to content

Goals: a met goal says how long the work took - #396

Merged
rromenskyi merged 2 commits into
mainfrom
goal-elapsed
Oct 31, 2026
Merged

rromenskyi merged 2 commits into
mainfrom
goal-elapsed

Conversation

@rromenskyi

Copy link
Copy Markdown
Contributor

When the judge confirms a goal, the agent now ends with a line like:

  ✓ goal met — worked 1h12m over 3 runs

What it counts:

  • Worked is the working time of every run at the goal. It uses the existing runDuration, which already leaves out time spent waiting on an approval prompt. It is stored in goal.json (worked_ns, runs), so the total survives /goal go resumes and restarts.
  • A goal replaced with different text starts its own count. A run with no standing goal counts toward nothing.
  • In the TUI the line comes from a goal_done event emitted after the answer. Plain mode prints it after the answer.

Tests are in cmd/agent/goal_time_test.go:

  • accumulation across a restart, plus resets;
  • the duration format (42s, 4m05s, 1h12m);
  • rendering the event;
  • an end-to-end runTaskStreaming run with a fake model whose judge says DONE. It checks that goal_done carries this run's time.

A sabotage pass made 10 mutations, and every one failed a test. The plain-mode print in runOne has no test, because it writes straight to stdout.

🤖 Generated with Claude Code

When the judge confirms a goal, the agent now ends with
"✓ goal met — worked 1h12m over 3 runs": the working time of every run at
the goal (runDuration: approval waits left out), carried in goal.json
across /goal go resumes and restarts, and how many runs that was. A goal
replaced with different text starts its own count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude 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.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

addGoalWork saves the goal: a run that failed never reached finishGoal's
save, and its time was lost to the next restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rromenskyi
rromenskyi merged commit 45ba1d2 into main Oct 31, 2026
2 checks passed
@rromenskyi
rromenskyi deleted the goal-elapsed branch October 31, 2026 03:50
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.

1 participant