Skip to content

feat(script): add self-improve.sh unattended issue-fixing loop - #41

Closed
jfenal wants to merge 3 commits into
bobbyjohnstx:mainfrom
jfenal:feat/self-improve-script
Closed

jfenal wants to merge 3 commits into
bobbyjohnstx:mainfrom
jfenal:feat/self-improve-script

Conversation

@jfenal

@jfenal jfenal commented Oct 10, 2026

Copy link
Copy Markdown

What this does

Adds scripts/self-improve.sh, an unattended loop that drives a local tinycode serve through the open-issue backlog: picks an actionable issue, creates a session, prompts the agent to fix it and open a PR, polls until idle, then archives.

Key points

  • Opt-in safety: refuses to start unless SI_ALLOW=1 is set; writes an isolated TINYCODE_CONFIG_DIR with autoApprove enabled.
  • Issue selection: oldest first, skipping already-attempted ($SEEN this run), $SI_SKIP_ISSUES, and labels in $SI_LABEL_SKIP (default dup,help wanted,wontfix).
  • Auth: every request uses Authorization: Bearer $TOKEN (no ad-hoc env toggles).
  • Control: --rounds N, --model provider/model, --label L, a positional SPECIFIC_ISSUE, and --list-issues.
  • Endpoints used all verified against internal/server/router.go: POST /session, POST /session/{id}/prompt_async, GET /session/{id}/message, GET /session/status, POST /session/{id}/abort, POST /session/{id}/archive.

Validation

  • bash -n passes (syntax clean).
  • jq filter logic (number-exclusion + label-skip) unit-tested against fixture data.
  • API path and payload shapes cross-checked against the Go handlers.

Notes

  • New file only; no Go changes. (Local go build is gated on the repo's go 1.27.1 requirement vs. a 1.26 local toolchain — unrelated to this script, which is pure bash.)

Drives a local 'tinycode serve' to work through the open-issue backlog:
- writes an isolated TINYCODE_CONFIG_DIR with autoApprove enabled
- requires SI_ALLOW=1 before starting
- picks the oldest actionable open issue (skipping $SEEN, $SI_SKIP_ISSUES,
  and $SI_LABEL_SKIP), creates a session, prompts the agent to fix it and
  open a PR, polls until idle, archives the session
- respects SI_LABEL_FILTER, --rounds N, and a SPECIFIC_ISSUE positional
- reuses the 'Authorization: Bearer $TOKEN' header for every request
@jfenal
jfenal requested a review from bobbyjohnstx as a code owner October 10, 2026 05:43
jfenal and others added 2 commits October 10, 2026 07:53
… to CLAUDE.md

GOTOOLCHAIN=auto keeps bumping go.mod to 1.27.1 and tinycode sessions
were reverting exit tool additions. Document the constraint in CLAUDE.md
so agents know not to touch the go directive.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The server reads its auth token from $DATADIR/web_token — there is no
way to inject a custom token via env var. Drop the unused random TOKEN,
use TINYCODE_FORCE_NO_AUTH=1 (safe: server binds to 127.0.0.1 only).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@bobbyjohnstx

Copy link
Copy Markdown
Owner

Interesting concept, but several issues:

  1. The ExitTool publishes "app.exit" but nothing subscribes to it — the tool is a no-op.
  2. The script targets GitHub (gh CLI) but the project uses Gitea for issues.
  3. go.mod downgrade from 1.27.1 to 1.25.0.
  4. autoApprove + no resource limits needs security review.

Closing — the self-improve loop concept is worth exploring separately once the exit tool has a subscriber and the script supports Gitea.

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