gitlab

Agentic coding is only as good as its context (opens in new tab)

Coding agents are only as effective as the context they can access. Repository-only agents may produce compiling fixes, but they often miss issue requirements, CI rules, security policies, and review standards. Integrating agents with GitLab’s issues, merge requests, pipelines, and security controls produces better-aligned code, fewer review cycles, and safer releases while preserving human approval.

From Repository Context to Full Lifecycle Context

  • GitLab tutorials demonstrate progressively richer workflows using Claude Code and Codex.
  • Repository only: The agent reads local files, interprets the prompt, and runs the build, but lacks acceptance criteria, organizational requirements, and review expectations.
  • Repository plus issue: Through GitLab’s MCP server, the agent can read issue descriptions, labels, milestones, and implementation notes.
    • It can correctly link changes to issues, such as adding Closes #32.
    • Tools such as get_issue and create_merge_request connect implementation work to planned work.
  • Working inside the merge request: GitLab’s Code Review Flow provides feedback, which the agent can address by adding tests, improving documentation, and fixing validation gaps.
    • New commits automatically trigger CI/CD.
    • Human reviewers can inspect the result in the same merge request.
    • The tutorials report fewer review rounds and shorter merge times.

Why Platform Visibility Matters

  • Platform teams determine:
    • Which agents and tools are permitted
    • How agent output is verified
    • Where human approval is required
  • Important context lives in the DevSecOps platform:
    • Issues define requirements.
    • CI/CD configuration defines quality standards.
    • Review instructions establish coding conventions.
    • Security scanners enforce vulnerability policies.
    • Merge requests bring automation and human review together.
  • IDE- or terminal-based agents generally see only the files provided to them, while the platform sees the full lifecycle, including deployment targets and approval rules.
  • Consequently, the platform—not the agent alone—largely determines what can ship safely.

Security Implications of Faster Code Generation

  • Agents produce code and remediation patches faster, increasing both the number of vulnerabilities and the number of security fix merge requests.
  • The bottleneck shifts from finding vulnerabilities to deciding which AI-generated fixes should be reviewed and approved first.
  • Effective prioritization requires broader context, including:
    • Application data flows
    • Deployment environments
    • Project-wide code
    • Organization-wide security policies
  • GitLab’s security layer can filter false positives, confirm vulnerabilities, and use surrounding repository context to propose fixes.
  • Agentic SAST vulnerability resolution creates a merge request with the proposed remediation.
  • CI/CD validates the change, while a human reviewer retains final approval.
  • Strong quality gates and security controls applied within merge requests reduce the chance that vulnerabilities reach production.

Repository Instructions with AGENTS.md

  • The tutorials use AGENTS.md to provide project-specific instructions.
  • These files can describe:
    • Repository structure
    • Commands to run
    • Code-quality expectations
    • Files or areas that must not be changed
    • Language and framework conventions
    • CI image-pinning requirements
    • Concurrency patterns
  • Custom instructions help agents operate consistently with project standards, even before they receive broader platform context.

Organizations should connect coding agents to the systems that define requirements, quality, security, and approval. Repository access may enable a working patch, but lifecycle context is what makes that patch trustworthy and ready to merge.