The Feedback Loop feature allows you to iteratively improve Tembo’s AI-generated solutions by providing natural language feedback directly on GitHub pull requests. When you comment with feedback, Tembo automatically retries and updates the PR with improved code.

How It Works

  1. Initial Solution: Tembo creates a pull request to solve an issue
  2. Review & Comment: You review the PR and leave feedback mentioning “tembo” or “@tembo”
  3. Automatic Retry: Tembo processes your feedback and updates the PR with improvements
  4. Iteration: Continue providing feedback until you’re satisfied with the solution

Getting Started

Step 1: Review the Generated PR

When Tembo creates a pull request for an issue, you’ll receive a GitHub notification. Review the changes and identify areas for improvement.

Step 2: Leave Feedback

Comment on the pull request with your feedback. Important: Make sure to mention “tembo” or “@tembo” in your comment for the system to detect it.

Example comments:

@tembo This looks good but can you add error handling for the database connection?
tembo please use TypeScript interfaces instead of any types
The solution works but could you optimize the query performance? @tembo

Step 3: Watch Tembo Respond

Once you post your comment:

  1. 👀 Eyes Reaction: Tembo acknowledges your feedback
  2. 🚀 Rocket Reaction: Tembo starts processing the changes
  3. Updated PR: New commits appear with improvements based on your feedback

Advanced Features

Context-Aware Updates

Tembo considers multiple sources when updating your PR:

  • Your Comments: All feedback comments on the PR
  • Existing Code: The current state of the repository
  • PR Diff: The changes already made
  • Original Issue: The problem being solved

Credit Management

Each feedback iteration consumes organization credits. Ensure your organization has sufficient credits before requesting changes.

Status Tracking

Tembo automatically tracks PR status:

  • Open: PR is active and can receive feedback
  • Merged: PR has been merged into the main branch
  • Closed: PR was closed without merging

Best Practices

Writing Effective Feedback

✅ Be Specific

@tembo Add input validation for the email field using regex

❌ Too Vague

tembo fix the validation

✅ Request Concrete Changes

@tembo Please extract this logic into a separate utility function

❌ General Comments

tembo this could be better

Multiple Iterations

You can provide feedback multiple times on the same PR. Each comment mentioning Tembo triggers a new update cycle, allowing for iterative refinement.

Code Quality Requests

Tembo can help with:

  • Performance Optimization: “optimize this query for better performance”
  • Error Handling: “add proper error handling and logging”
  • Code Structure: “refactor this into smaller, more maintainable functions”
  • Type Safety: “add proper TypeScript types”
  • Testing: “include unit tests for this functionality”
  • Documentation: “add JSDoc comments to these functions”

Technical Implementation

The Feedback Loop integrates several components:

GitHub Webhook Processing

  • Listens for issue_comment.created events
  • Filters comments mentioning “tembo” or “@tembo”
  • Validates the comment is on a Tembo-created PR
  • Queues feedback processing jobs

Reference: tembo-v2/apps/api/src/server.ts:78-243

AI Processing

  • Extracts all PR comments for context
  • Analyzes the existing code diff
  • Generates improved solutions based on feedback
  • Commits changes to the PR branch

Reference: tembo-v2/apps/agent/src/jobs/solve_issue.rs

Visual Feedback

  • 👀 Reaction: Feedback acknowledged
  • 🚀 Reaction: Processing started
  • New Commits: Updated solution pushed

Troubleshooting

Tembo Isn’t Responding to Comments

Check these requirements:

  1. Mention Detection: Comment must include “tembo” or “@tembo”
  2. PR Source: PR must be created by tembo-io[bot]
  3. User Type: Comment must be from a human user (not a bot)
  4. Organization Credits: Sufficient credits must be available
  5. Integration Status: GitHub integration must be active

Feedback Not Applied Correctly

  • Be More Specific: Provide clearer, more detailed feedback
  • Check Context: Ensure your feedback relates to the existing PR changes
  • Multiple Comments: Break complex feedback into smaller, focused comments

PR Status Issues

If PR status isn’t updating correctly:

  1. Verify GitHub webhook delivery in your repository settings
  2. Check organization integration status in Tembo dashboard
  3. Ensure proper repository permissions for the Tembo GitHub App

Rate Limits

To prevent excessive API usage:

  • Each comment triggers one feedback processing cycle
  • Multiple mentions in the same comment count as one request
  • Bot comments are automatically ignored to prevent loops

The Feedback Loop makes AI-generated code truly collaborative, allowing you to guide Tembo toward the exact solution you need through natural language feedback.