AI Interview Handbook
CHAPTER 09SENIOR SIGNAL

Leadership, Coding & Communication

Strengthen practical coding and SQL while preparing staff-level stories, design writing, remote influence, mentoring, and conflict resolution.

18 min read Interview drills

Learning objectives

This chapter turns seniority into observable behavior: sound decisions, useful written artifacts, calm coding, and evidence that other people became more effective because of your work.

  • Build six truthful leadership stories that separate personal ownership from team outcomes.
  • Lead an ambiguous architecture decision without relying on title or authority.
  • Write an async design memo, decision record, status update, and review comment that lets others act.
  • Solve coding problems by clarifying contracts, selecting a pattern, proving correctness, and testing edges.
  • Handle practical Python, SQL, API, and debugging screens with production judgment.
  • Review AI-assisted code as accountable engineering work, not as trusted output.

Make staff-level scope visible

A senior answer is not made senior by saying “I led.” It becomes senior when the interviewer can trace how you framed an unclear problem, changed a consequential decision, created leverage beyond your own code, and verified the result.

The six-story portfolio

Prepare one story for each row. A story may cover more than one row, but do not force every question into the same heroic project.

Leadership story portfolio
StoryDecision worth explainingEvidence to bring
Architecture without authorityHow you converted competing constraints into an accepted directionDecision memo, rejected alternatives, rollout gate
Standards and leverageWhy a reusable pattern was better than another one-offReference implementation, adoption trail, maintenance effect
MentoringHow you diagnosed a capability gap and transferred ownershipReview progression, learning plan, later independent decision
DisagreementWhat evidence changed the discussion and what you concededExperiment, ADR, decision log, follow-up result
Technical debt or incidentWhy remediation displaced other workRisk model, incident timeline, prevention and detection controls
Customer or product outcomeHow field evidence altered requirements or sequencingDiscovery notes, success measure, rollout feedback

Use STAR-L, but keep the “A” inspectable

Situation gives only the context needed to understand the stakes. Task names your mandate and constraints. Action should consume roughly half the answer: questions asked, analysis performed, options rejected, people aligned, safeguards added, and course corrections. Result separates measured outcomes from impressions. Learning says what you would repeat or change.

Lead decisions, not meetings

Influence without authority comes from improving the decision environment. Make the problem legible, expose trade-offs, invite the right objections, and leave a durable record.

Frame

Name the decision, owner, deadline, non-goals, constraints, and reversible versus irreversible parts.

Compare

Evaluate two or three viable options against explicit criteria such as quality, latency, operability, privacy, and migration cost.

De-risk

Run the smallest experiment that resolves the largest uncertainty. Do not prototype what documentation already answers.

Commit

Record the chosen option, dissent, triggers for revisiting it, rollout, rollback, and who owns follow-through.

A compact architecture decision record

Title: Choose the retrieval serving path
Status / owner / decision date:
Context: users, scale, sensitivity, current failure
Decision drivers: quality, p95 latency, cost, operations
Options: A / B / C, with evidence and migration effort
Decision: chosen option and why now
Consequences: gains, accepted debt, new risks
Rollout: shadow → limited cohort → broader release
Rollback and revisit triggers:

The record is not a ceremony. It is a compression mechanism: a teammate in another time zone should be able to challenge or execute the decision without reconstructing a meeting.

Resolve disagreement with a ladder

  1. Restate the shared objective and the other position until its owner agrees.
  2. Classify the disagreement: facts, forecasts, values, constraints, or ownership.
  3. Seek disconfirming evidence and define a time-boxed test when the decision is reversible.
  4. Ask the accountable owner to decide when evidence cannot remove uncertainty.
  5. Disagree, commit, and log a revisit trigger rather than relitigating continuously.

Write so work can continue without you

Current Remote and Sourcegraph role pages explicitly emphasize structured writing, async work, customer communication, autonomy, and substantive review. Treat writing as part of system reliability: missing context creates coordination failures just as missing timeouts create runtime failures. See the live Remote Senior Forward Deployed Engineer role and Sourcegraph Agent Engineer role.

The five-block async update

Outcome: what changed for the user or project
Evidence: test, metric, trace, screenshot, or decision
Risk: what could still invalidate the result
Next: owner and date for the next concrete action
Ask: one explicit decision or help request, if needed

Lead with the outcome, not an activity diary. Replace “worked on evaluation” with “the release gate now catches the three known citation regressions; the multilingual slice is still below its proposed threshold.”

Design memo anatomy

A two-page memo should cover problem and non-goals, users and success measures, constraints and assumptions, proposed flow, alternatives, failure modes, security, operations, rollout, and unresolved questions. Put the recommendation near the top. Attach detailed benchmarks rather than burying the decision beneath them.

Code-review comments that create leverage

Tag the nature of the comment: blocker for correctness or safety, important for maintainability, suggestion for a worthwhile alternative, and nit for optional polish. State the consequence and, where useful, a concrete path forward. Google’s engineering review guide and GitHub’s pull-request review documentation are useful primary references for review practice and review states.

Translate trade-offs for customers

Use consequence language. “A reranker adds another model call” is technical description. “A reranker may improve the difficult queries we sampled, but adds latency and cost to every request; we propose enabling it only for low-confidence queries and measuring both task success and p95 latency” is a decision a customer can evaluate.

Make coding reasoning observable

Senior coding screens still require fundamentals, but the strongest signal is controlled problem solving: establish the contract, choose the simplest correct structure, prove the invariant, and test the boundaries.

The 40-minute loop

  1. Clarify: input size, ordering, duplicates, empty values, mutation, return contract, and error behavior.
  2. Example: walk one normal case and one adversarial case by hand.
  3. Baseline: give a correct simple approach and its time/space cost.
  4. Pattern: choose map/set, two pointers, sliding window, stack, heap, binary search, traversal, backtracking, greedy, or dynamic programming because a specific invariant fits.
  5. Implement: name state by meaning and narrate only consequential choices.
  6. Verify: trace edges, state complexity, and identify what would change at production scale.
Pattern recognition prompts
SignalLikely patternInvariant to explain
Longest/shortest contiguous rangeSliding windowWhen moving the left edge restores validity
Top k or repeatedly smallestHeapHeap contains only the best candidates seen
Reachability or dependenciesBFS/DFS/graphVisited state prevents repeated work or cycles
Monotone answer predicateBinary search on answerAll values on one side share feasibility
Overlapping choicesDynamic programmingState captures all information future choices need

Practise the work-shaped screens

The syllabus calls out async Python, SQL, APIs, transformations, tests, unfamiliar code, and reading Go or TypeScript. These exercises reward production instincts more than puzzle tricks.

Async Python: concurrency needs ownership

import asyncio

async def fetch_all(ids, fetch_one):
    async with asyncio.TaskGroup() as group:
        tasks = {item_id: group.create_task(fetch_one(item_id))
                 for item_id in ids}
    return {item_id: task.result() for item_id, task in tasks.items()}

TaskGroup gives the subtasks a lifetime owned by the context. Discuss timeouts, bounded concurrency, partial-result policy, and cancellation cleanup; the Python documentation explains that task-group failure cancels remaining tasks and that cleanup should propagate cancellation after finally work. Read the official coroutines and tasks documentation.

SQL: express the business question first

WITH ranked AS (
  SELECT tenant_id, run_id, cost_usd,
         row_number() OVER (
           PARTITION BY tenant_id ORDER BY cost_usd DESC
         ) AS cost_rank
  FROM agent_runs
  WHERE started_at >= :window_start
)
SELECT tenant_id, run_id, cost_usd
FROM ranked
WHERE cost_rank <= 3;

This asks for the three most expensive runs per tenant, not the three most expensive globally. Explain tie semantics (row_number versus rank), indexes supporting the filter, and why an execution plan matters. Use the official PostgreSQL guides to window functions and EXPLAIN.

API implementation checklist

  • Validate request shape and semantic constraints; return stable error contracts.
  • Derive identity and tenant scope from authentication, not caller-supplied fields.
  • Define idempotency, timeout, retry, concurrency, and transaction boundaries.
  • Test happy path, malformed input, duplicate request, dependency timeout, and forbidden access.
  • Expose correlation identifiers and useful telemetry without logging secrets.

Debugging unfamiliar code

Restate the symptom, bound the blast radius, reproduce with the smallest input, trace data across boundaries, and form ranked hypotheses. Change one variable at a time. A senior candidate distinguishes mitigation from root-cause correction and adds a regression test plus a detection improvement.

AI-assisted code is still your code

Record the prompt or intent when relevant, inspect every changed line, verify dependencies and licenses, threat-model new data paths, run targeted and broader tests, and be ready to explain the result without the assistant. Current Sourcegraph and Automattic application material asks candidates for concrete opinions about coding agents; speak from a real workflow, while never presenting generated code as independently trustworthy.

Syllabus checkpoint: complete coding-pattern coverage

Keep a compact mental map rather than memorizing isolated solutions. Arrays and strings reward index discipline, maps/sets capture membership and counts, and two pointers or sliding windows exploit ordered or contiguous structure. Stacks model nested or monotonic state; queues model FIFO work; linked lists test pointer ownership and edge cases. Binary search needs a monotone predicate, while interval problems require explicit boundary semantics.

Trees and graphs share traversal machinery but different invariants: tree DFS supports subtree/postorder reasoning, BFS supports levels and minimum unweighted hops, and general graphs require cycle/visited handling. Heaps maintain an extremum or top-k frontier. Backtracking explores a choice tree with pruning; greedy algorithms require an exchange or staying-ahead argument; dynamic programming requires a state that contains all information future choices need. For every pattern, explain correctness, time/space complexity, empty/singleton/duplicate cases, and how you would test it.

Interview playbook

Choose the framework that matches the signal being tested, then keep the answer evidence-led.

Leadership answer: Scope → Judgment → Leverage → Evidence → Learning

  1. Scope: users, stakes, constraints, your mandate, and what was ambiguous.
  2. Judgment: alternatives and the pivotal decision, including what you rejected.
  3. Leverage: how you aligned people or created a pattern others could use.
  4. Evidence: measured result, rollout observation, or honest qualitative outcome.
  5. Learning: a specific correction you would make next time.

Coding answer: Contract → Baseline → Invariant → Code → Tests → Cost

Clarify the contract, state a correct baseline, name the invariant behind the better approach, implement, trace tests, then give time and space complexity. Mention production concerns only after solving the asked problem.

Common traps

  • Using “we” throughout so the interviewer cannot locate personal ownership.
  • Claiming consensus when a real decision owner or disagreement existed.
  • Giving activity metrics instead of an outcome or risk reduction.
  • Narrating every keystroke during coding instead of decisions and invariants.
  • Ignoring cancellation, authorization, duplicates, or failure behavior in practical tasks.
  • Claiming AI assistance made work faster without showing verification or a quality boundary.

Question bank

Answer aloud. Keep leadership answers near two minutes initially; allow follow-up probes to reveal the deeper evidence.

Q1Tell me about an architecture you led without formal authority.

Strong answer outline

  1. Define the ambiguous decision, affected teams, constraints, and your actual mandate.
  2. Show the options, evidence, dissent, and the mechanism used to reach a decision.
  3. Close with adoption, measured or observed outcome, and one learning.

Follow-up probes

  • Who initially disagreed, and why?
  • Which outcome belongs to you versus the team?
Self-check

A strong answer makes influence mechanisms and personal actions inspectable; “I convinced everyone” without evidence does not pass.

Q2Two senior engineers disagree about an agent framework. How do you move the decision forward?

Strong answer outline

  1. Align on workload, reliability boundary, team capability, and decision deadline.
  2. Turn preferences into criteria; test the highest-risk unknown with a thin vertical slice.
  3. Let the accountable owner decide, record dissent and revisit triggers, then commit.

Follow-up probes

  • What if the benchmark is inconclusive?
  • When would you override consensus?
Self-check

Include ownership and reversibility. Endless consensus-seeking or framework feature comparison alone is insufficient.

Q3How would you make a build-versus-buy decision for an LLM gateway?

Strong answer outline

  1. Define required routing, policy, observability, data handling, provider support, and exit constraints.
  2. Compare total ownership cost, integration risk, control, roadmap fit, and vendor lock-in.
  3. Propose a reversible pilot with acceptance thresholds and an exit plan.

Follow-up probes

  • What evidence would reverse your choice?
  • How do security review and incident ownership change the answer?
Self-check

The answer must address lifecycle and migration, not just license price or feature count.

Q4A capable teammate repeatedly ships prompt changes without evaluation. How do you mentor them?

Strong answer outline

  1. Use a concrete escaped regression to establish the capability gap without personal blame.
  2. Pair on a minimal golden set, threshold, and review checklist; explain why each layer exists.
  3. Transfer ownership and later inspect whether they can design the next gate independently.

Follow-up probes

  • What if delivery pressure rewards the shortcut?
  • How do you know mentoring worked?
Self-check

Pass only if the story changes the system and builds independent judgment, rather than merely correcting one pull request.

Q5Write the verbal version of an async update after a failed canary deployment.

Strong answer outline

  1. Lead with outcome: canary rolled back and stable version remains serving.
  2. Give evidence and scope: triggering SLI, affected cohort, and current customer impact.
  3. Name leading hypothesis, next owner/date, and one explicit ask; avoid declaring root cause prematurely.

Follow-up probes

  • What details belong in the incident channel rather than the executive update?
  • When do you update again?
Self-check

The update must let readers understand safety, uncertainty, ownership, and next action in under a minute.

Q6What makes a code-review comment blocking rather than optional?

Strong answer outline

  1. Block correctness, security, privacy, data loss, broken contracts, or unacceptable operability risk.
  2. Explain consequence and evidence, not authority or taste.
  3. Offer a correction or clarify the acceptance condition; label non-blocking design ideas honestly.

Follow-up probes

  • What if the style issue violates a team standard?
  • How do you handle a disputed blocker?
Self-check

A good answer preserves a high bar without using review as a vehicle for preference or scope expansion.

Q7Design an O(n) solution for the longest substring with at most k distinct characters.

Strong answer outline

  1. Clarify empty input, k ≤ 0, and character model.
  2. Maintain a frequency map for a window; advance right, then move left until distinct count is valid.
  3. Each pointer moves at most n times: O(n) time and O(min(n, alphabet)) space.

Follow-up probes

  • How would you return the substring, not its length?
  • Which invariant must hold before updating the maximum?
Self-check

Trace a repeated-character case and a window requiring multiple left moves; state the invariant precisely.

Q8When would you choose BFS rather than DFS for a dependency graph?

Strong answer outline

  1. Use BFS for minimum unweighted hop count or level-order processing.
  2. Use DFS for exhaustive exploration, cycle detection patterns, or postorder dependencies when recursion depth is controlled.
  3. State directedness, cycle behavior, visited state, and memory trade-off.

Follow-up probes

  • How do you produce a topological order?
  • What changes for weighted edges?
Self-check

Do not claim one traversal is universally faster; tie the choice to the required output and graph shape.

Q9An async endpoint fans out to three model providers. Define timeout and cancellation behavior.

Strong answer outline

  1. Set an end-to-end deadline and derive smaller per-attempt budgets; bound concurrency.
  2. Choose first-valid, quorum, or all-results semantics before selecting a primitive.
  3. Cancel work that can no longer affect the response, propagate cancellation after cleanup, and record provider outcomes.

Follow-up probes

  • When would shielding be justified?
  • How do retries interact with the deadline?
Self-check

Pass if the answer covers ownership, cleanup, partial results, and retry amplification—not merely asyncio.gather.

Q10Write SQL for the three highest-cost agent runs per tenant and explain tie behavior.

Strong answer outline

  1. Use a window function partitioned by tenant and ordered by cost descending.
  2. Select row_number for exactly three rows or rank/dense_rank when ties should be preserved.
  3. Filter in an outer query; discuss time predicate and supporting index using EXPLAIN.

Follow-up probes

  • How do null costs sort?
  • What if tenant cardinality is extremely skewed?
Self-check

The query and verbal contract must agree on ties, time window, and deterministic ordering.

Q11An unfamiliar webhook service creates duplicate payroll actions. How do you debug it?

Strong answer outline

  1. Mitigate harmful processing, preserve evidence, and bound affected events and tenants.
  2. Trace provider delivery IDs through ingress, queue, worker, and database transaction; test retry and crash boundaries.
  3. Fix with durable idempotency at the side-effect boundary, add replay tests and duplicate-rate telemetry.

Follow-up probes

  • What if the provider supplies no stable event ID?
  • How do you reconcile already duplicated actions?
Self-check

Distinguish duplicate delivery from duplicate effect and mitigation from root cause.

Q12How do you review code produced by a coding agent?

Strong answer outline

  1. Re-establish requirements and inspect the diff, dependencies, and changed trust boundaries.
  2. Run targeted tests, adversarial cases, static checks, and broader regression tests appropriate to risk.
  3. Refactor or reject code you cannot explain; record material AI assistance when policy requires it.

Follow-up probes

  • Which failures are tests unlikely to reveal?
  • When is generated code inappropriate?
Self-check

A credible answer includes a real verification workflow and makes the engineer—not the tool—accountable.

Q13Explain a relevance-versus-latency trade-off to a non-technical customer.

Strong answer outline

  1. Start with the user consequence: harder questions may improve while every response could slow.
  2. Show representative evidence and important slices, not a single aggregate score.
  3. Offer a bounded decision: selective reranking, a latency guardrail, cohort rollout, and stop condition.

Follow-up probes

  • What if the customer asks for “best quality” at any cost?
  • How will users notice the difference?
Self-check

Avoid jargon-only explanations; include choice, consequence, evidence, and control.

Q14How do you decide whether technical debt should displace roadmap work?

Strong answer outline

  1. Quantify recurring delivery drag, incident exposure, security risk, and option value.
  2. Compare remediation size and timing against roadmap impact; separate urgent containment from durable repair.
  3. Propose a measurable slice with owner, success signal, and stop rule.

Follow-up probes

  • What if the risk has never caused an incident?
  • How do you avoid a vague “20% debt” program?
Self-check

Prioritize by expected consequence and leverage, not by developer annoyance or architectural purity.

Proof artifact: the senior-signal packet

Create one reviewable packet that combines leadership, writing, implementation, and explanation. Use a real project only where you can disclose it; otherwise build a clearly labeled sandbox case.

Build it

  1. Choose a decision such as adding a reranking stage to a multi-tenant RAG service.
  2. Write a two-page design memo and one ADR with criteria, alternatives, security, operations, rollout, rollback, and revisit triggers.
  3. Implement a small async API plus a SQL report. Add tests for invalid input, timeout, cancellation, duplicate requests, and cross-tenant access.
  4. Request or simulate review; classify comments and record which feedback changed the design.
  5. Prepare a two-minute leadership account that states personal ownership without inventing project results.

Measure it

  • Memo: decision visible in the first 200 words; every risk has an owner or acceptance statement.
  • Code: test pass rate, branch coverage for critical failure paths, static checks, and p50/p95 latency under a declared load.
  • Communication: a reviewer can state the decision, main trade-off, and next action after one read.
  • Practice: solve and explain the coding task within a fixed time; log clarification, implementation, and verification minutes separately.

If you need numbers before measurement, label them as targets. For example: “hypothetical target: p95 below 800 ms at 20 requests/second,” never as a achieved result.

Inject failure deliberately

Make one downstream call exceed its timeout, send the same idempotency key twice, cancel the client request mid-flight, and attempt a cross-tenant identifier. Verify cleanup, stable error behavior, one durable side effect, and useful trace context. Then seed an AI-generated implementation with a subtle missing tenant predicate and demonstrate that review or tests catch it.

Present it

Bring the memo, ADR, small repository, test report, one trace, review log, and a ten-minute recording. Present the decision in two minutes, code invariant in two, failure evidence in three, and learning in one; reserve two minutes for questions.

Chapter review

Leadership is decision quality plus leverage. Coding is a visible chain from contract to proof. Remote communication is successful when another person can decide or act without recovering missing context.

Glossary

ADR
A short, durable record of an architecture decision, its context, consequences, and revisit conditions.
Invariant
A property that remains true while an algorithm progresses and supports its correctness argument.
Leverage
An intervention that improves the output or judgment of people beyond the author’s own task.
Structured concurrency
A model in which concurrent tasks have explicit ownership and bounded lifetimes.
Revisit trigger
Observable evidence that should cause a prior decision to be re-examined.
Window function
A SQL calculation across related rows while retaining each input row.

Mastery checklist

  • I have six distinct, truthful stories with personal actions and defensible evidence.
  • I can name the decision owner, rejected option, and revisit trigger in each architecture story.
  • I can write an outcome-led update and a two-page memo without a meeting transcript.
  • I can distinguish blocker, important, suggestion, and nit review feedback.
  • I can solve representative map/window, graph, heap, and basic DP problems while explaining invariants.
  • I can reason about async cancellation, SQL ties, API idempotency, authorization, and failure tests.
  • I can explain exactly how I verify AI-assisted code.

Primary sources

Checked: 2026-08-04. Role requirements and URLs are volatile; re-open the official posting before applying.

Search all 12 chaptersResults include concepts, worked examples, and interview questions.