Skip to content

feat(agentic): configure proposer completion budget - #804

Draft
cgfixit wants to merge 1 commit into
mainfrom
cx/agentic-proposer-completion-budget
Draft

feat(agentic): configure proposer completion budget#804
cgfixit wants to merge 1 commit into
mainfrom
cx/agentic-proposer-completion-budget

Conversation

@cgfixit

@cgfixit cgfixit commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

Makes the existing real-repo proposer completion budget configurable. Default remains 2048; no new agent framework is introduced.

Invariant / CG-Security Invariant Check (CyClaw)

  • Preserves I6 module isolation and the existing default-off real-repo/cloud gates.
  • Positive integer validation happens at the agentic config boundary.
  • No core RAG, graph routing, telemetry, filesystem authority, or provider eligibility changed.

Verification Steps before commit

  • Python 3.12 focused config, plan-handoff, CLI, and real-loop pytest suite passed.
  • Ruff passed; invariant guard passed (33/0); doc sync found 0 drift; staged diff check passed.
  • Fresh-main throwaway trial merge passed without conflicts or unmerged files.
  • Bandit is not installed in this environment; its result is not claimed.

Scope and risks

  • planner_max_tokens reaches only real-repo plan/coding calls; it does not alter the separate harness optimizer.
  • Raising it can exceed the available Ollama context or the existing timeout; default 2048 preserves current behavior.
  • Remote CI remains pending.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR template check (advisory, non-blocking)

This PR body doesn't look like it covers everything .github/PULL_REQUEST_TEMPLATE.md expects:

  • Risks to monitor (e.g. ## Risks to monitor, ## Risk)

This isn't a required check -- it won't block merge. See the template's own "Notes for contributors" for which sections lighter-path PRs can skip.

cgfixit commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

Nice fix — this closes the "no config knob" gap cleanly. One thing worth flagging before this merges, since the PR body already identifies raising the default as an open tradeoff without resolving it:

The 2048 default itself is very likely too small for real_repo_loop's actual output shape, independent of whether it's configurable. The module's planner protocol is documented whole-file replacement (real_repo_loop.py's own docstring: "the planner protocol is whole-file replacement"), and _parse_file_blocks requires a closing === END FILE === marker (the regex is re.DOTALL anchored on both markers). If a completion gets cut off mid-file at the 2048-token boundary — easy to hit for even one moderately-sized Python file, let alone a multi-file patch — the block regex simply won't match, and the iteration fails with no useful signal that "truncation" was the cause, burning one of max_iterations for free every time it happens.

Both proposer paths share this exposure identically: LocalProposerClient.invoke() (model_adapter.py) and ChatModelProposerClient.invoke() (chat_client.py) both default max_tokens=2048 on the same ProposerClient Protocol, and neither of the two real call sites in real_repo_loop.py overrides it — this PR's own diff confirms that by threading the same 2048 through explicitly rather than changing it.

Not asking for a change in this PR — the config knob standing alone is a legitimate, well-scoped fix. Just flagging that "raise it after measuring" (per your new comment) may be closer to "raise it as a follow-up default-value change" than an edge case, since the failure mode is silent (a rejected iteration, not an error naming truncation as the cause). Happy to pick up a small follow-up PR bumping the default once this lands, if useful — didn't want to submit a competing edit to the same lines while this is still open.


Generated by Claude Code


Generated by Claude Code

@cgfixit
cgfixit force-pushed the cx/agentic-proposer-completion-budget branch from bac9c2d to d352d68 Compare August 5, 2026 21:25
@cgfixit
cgfixit force-pushed the cx/agentic-proposer-completion-budget branch from d352d68 to 11a8901 Compare August 6, 2026 01:08
cgfixit pushed a commit that referenced this pull request Aug 6, 2026
…ly stale

Two more codex findings on the same section fixed in the prior commit:

- The documented recovery (checkout main, fetch, hard-reset main) only
  helps when local main itself is what's stale. Run the quick-check from a
  feature branch that's simply behind (the common case for an agent branch
  cut before a later merge landed on main) and it reports
  REWRITE/DIVERGED, but resetting main does nothing for that branch --
  switching back to it fails the same check and the pre-push gate still
  refuses it. Verified against this session's own history: PR #804/#809/#810
  were in exactly this state (cut before #802 merged) and the fix was
  `git rebase origin/main` on each feature branch, not a main reset.
- `git reset --hard origin/main` was presented unconditionally, with no
  check for unique local commits or uncommitted work it would discard.
  `git reset -h` confirms --hard resets HEAD, the index, and the working
  tree. CLAUDE.md's own Git Safety Protocol treats `reset --hard` as
  destructive and never to run without explicit confirmation; this doc
  contradicted that by presenting it as a bare recovery one-liner.

Added the feature-branch rebase path as the primary recovery, and gated the
main-reset path on `git status --short` being clean and
`git log origin/main..main` being empty first.

Co-Authored-By: CyClaw Agent <cyclaw-agent@users.noreply.github.com>
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